Attempts to upload a service definition file from ArcGIS Pro to ArcGIS Enterprise or ArcGIS Online using the Upload Service Definition tool fail, with the following error message returned:
Error: Error 002901: Sharing related error during geo-processing (Unable to check if service exists.
Specify the correct federated server URL when sharing a service definition
The correct URL for the federated server can be found in Portal for ArcGIS by navigating to Organization > Settings > Servers under Administration URL. The URL format is as follows:
Specify the correct SignInToPortal() portal URL, username and password
For ArcPy functions, the portal URL, username and password must be entered as follows:
arcpy.SignInToPortal("https://www.portal.domain.com/webadaptor", "MyUserName", "MyPassword", verify_cert=False)
Note: The verify_cert parameter is inserted to bypass verification if a self-signed certificate is used. The parameter can be removed accordingly.
To reset login credentials for an account with a token generated or for the primary site administrator, refer to Portal for ArcGIS: Recovering the portal when no administrator accounts are available or Portal for ArcGIS: Reset password for instructions.