We are currently looking for a way on how to automate service publishment (from a *.aprx file) to an ArcGIS Portal 10.7.1 with python, but this seems not to be possible if the portal is secured with web tier authentication with basic-authentication (WebAdaptor on Apache Tomcat with LDAP).
We've taken a look at this example: MapImageSharingDraft—Sharing module | Documentation and tried it with our secured portal, but it fails on the "exportToSDDraft"-Function with the following error:
The "federatedServerUrl" in our case is a basic-auth protected URL, thus the server cannot be reached, because arcpy seems not to correctly handle the login.
sharing_draft.federatedServerUrl = "https://MyFederatedServerUrl.esri.com/server"
Without *.sddraft, no *.sd file and without *.sd file no service publishment possible, neither with arcpy nor with the Python API for ArcGIS (where you need a *.sd file to publish the item to portal).
Question: How to generate *.sddraft files with secured portal?
As I read in the documentation MapImageSharingDraft—Sharing module | Documentation the portal information is read from the portals page in ArcGIS Pro (Portal information is obtained from the Portals page in ArcGIS Pro.).
Question: Is it possible to publish *.aprx files from python without having ArcGIS Pro installed?
Then I found this one here: SignInToPortal—ArcPy Functions | Documentation
With this function it should be possible to sign in to a portal, neither if it's in your portals page in ArcGIS Pro or not. But again, signing in to a secured portal throws an error. It seems that only Built-In Security Logins are allowed and not Enterprise logins.
Question: How to use arcpy.SignInToPortal() with secured portal?
In the past we already had a similiar way to automate publishing of map services to a standalone ArcGIS Server. Therefore we only needed the MXD and the service metainformatione generated in the *.sddraft file. The *.sddraft file could be generated inside ArcMap over the GUI. You just had to cancel the service publishment dialog and a *.sddraft was stored. This is no longer possible in ArcGIS Pro. The dialog where you have to specify all the meta information for the service like capabilities (FeatureServer, WMS ...) and Pooling (dedicated or shared, and instances) is not cancelable.
That means I would need to code every setting that is possible to do in the GUI, in the XML of the pregenerated *.sddraft. Is this really the way to go for Esri?
Question: Is there a better way to generate a *.sddraft file?
You should be able to, try the "actions" button beneath your active post.
But just in case....
has a list of resources.