I am trying to create a map service definition file in Python (see a snippet below). The code fails on the line arcpy.SignInToPortal:
arcpy.SignInToPortal("****", "****", "****")
File "D:\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 2468, in SignInToPortal
return _SignInToPortal(*args, **kwargs)
ValueError: Failed to sign out.
I confirmed that I am not logged in to the portal on the machine which the script is executed. The portal URL and the user credentials are correct as well. Why am I getting the error and how to get around it? Thanks!
----------------------------------------------------------------------------------------
Hi @azlotin,
My first guess would be the Portal URL.
I know that you have checked that it is correct, but do you have the real string identifier in front of the string?
e.g: r"https://<portal webadaptor url>/<webadaptor name>/"
If you have, then I would be looking to see if the script can ping the server first as t may be a network issue as well.
Thanks,
Michael
Did you ever get this resolved? I'm running into a similar issue.
I think Michael is spot on with the portal URL.
I ran into the same problem today, and found out that the portal URL read from a configuration file was something like this:
When I changed to
everything worked!
I second @CarstenB_orsted .
This worked for signing in to AGOL:
# Sign in to AGOL
arcpy.SignInToPortal("https://wcountygis.maps.arcgis.com/", "user", "pass")
arcpy.SignInToPortal(r"https://wcountygis.maps.arcgis.com/", "user", "pass")
This didn't work:
arcpy.SignInToPortal("https://wcountygis.maps.arcgis.com/home", "user", "pass")
arcpy.SignInToPortal(r"https://wcountygis.maps.arcgis.com/home", "user", "pass")
For us - this seems to be related to a self signed cert error. If using the Python API, GIS('myportalurl', username, password) fails with ssl validation error unless I add verify_cert=False as a parameter. The problem is, there is no way to do this using Arcpy.SignInToPortal, which is required for programmatically publishing services.