I am trying to create an sddraft file for publishing a arcgis pro project to our portal.
Below is my code.
sddraft_filename = "service.sddraft"
sddraft_output_filename = os.path.join(draftsOutputDir, sddraft_filename)
service_draft = m.getWebLayerSharingDraft("FEDERATED_SERVER", "MAP_IMAGE" , service)
service_draft.summary = "My Summary"
service_draft.tags = "My Tags"
service_draft.description = "My Description"
service_draft.credits = "My Credits"
service_draft.useLimitations = "My Use Limitations"
service_draft.overwriteExistingService = True
service_draft.allowExporting = True
service_draft.portalFolder = "User_Folder"
service_draft.federatedServerUrl = "https://MyFederatedServer.esri.com:6443/arcgis"
service_draft.copyDataToServer = False
service_draft.serverFolder = "Server_Folder"
# Create Service Definition Draft file
service_draft.exportToSDDraft(sddraft_output_filename)
Right when it execute the exportToSDDraft function, its throwing the following error.
Message=Error connecting to server: https://MyFederatedServer.esri.com:6443/arcgis
Source=C:\Users\user\AppData\Local\Programs\ArcGIS\Pro\Resources\ArcPy\arcpy\sharing.py
StackTrace:
File "C:\Users\user\AppData\Local\Programs\ArcGIS\Pro\Resources\ArcPy\arcpy\sharing.py", line 68, in exportToSDDraft
return _convertArcObjectToPythonObject(self._arc_object.exportToSDDraft(out_sddraft,self))
File "C:\Users\user\source\repos\PythonApplication1\PythonApplication1\PythonApplication1.py", line 118, in mapAndFeatureServicePublish
service_draft.exportToSDDraft(sddraft_output_filename)
File "C:\Users\user\source\repos\PythonApplication1\PythonApplication1\PythonApplication1.py", line 162, in <module> (Current frame)
mapAndFeatureServicePublish(m, draftsOutputDir, row, featureAccess = row['FEATURE ACCESS? (Y/N)'])
The federated url is correct as I copied it from the portal admin and in the list of federated server url.
Also I am able to connect to via normal url and create connection to it also.
Kindly advise.
Abdur Rahman
GIS Developer