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).
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?