arcpy.SignInToPortal() failed to sign in

3779
9
02-05-2020 05:52 PM
by Anonymous User
Not applicable

Hi all,

Trying to run below code in a stand-alone script from my laptop to connect a portal in a cloud environment. 

arcpy.SignIntoPortal("https://domain/arcgis","portaladmin","adminpasswrod") 

However, always getting an exception as:

Unable to connect ArcGIS Online.

if pasting above code in python window within ArcGIS Pro,  that works fine with a response like:

{'token': 'l4ZVIQ3I00lS2u-C_2f57FAYSwuDqmkaUIZVe7OZAY3FHG1HdipxRlA6szCMkrPq0Qe5xtDqOV0QvLZ4kXcGY0R8nu7yfNta-mzGFZwURBbg..', 'referer': 'http://www.esri.com/AGO/0077BA04-30C4-4F1F-81BF-F47BF2B277EE', 'expires': 1580995337}

Interesting thing i have noted that if open Fiddler when running the script, it successfully connected.

Suspecting this might relate to SSL. Just a check if anyone runs into this previously. 

Cheers

minbin

Tags (2)
0 Kudos
9 Replies
JoshuaBixby
MVP Esteemed Contributor

What is the full exception, with trace back?

0 Kudos
by Anonymous User
Not applicable

Hi  Josh, the full exception as outlined in the post: unable to sign into portal. 

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

You haven't included the trace back.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Minbin Jiang‌, are you still having this issue?

0 Kudos
by Anonymous User
Not applicable

Hey Joshua. No.. I didn't have this issue any more after import the certificates of ArcGIS portal into my local develop laptop. 

MarkCederholm
Occasional Contributor III

I'm seeing the same thing after upgrading ArcGIS Pro from 2.4.3 to 2.5.1 and Portal from 10.7 to 10.7.1:

>>> arcpy.SignInToPortal(sPortalUrl, sPortalUser, sPortalPass)
Traceback (most recent call last):
  File "<pyshell#8>", line 1, in <module>
    arcpy.SignInToPortal(sPortalUrl, sPortalUser, sPortalPass)
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 2468, in SignInToPortal
    return _SignInToPortal(*args, **kwargs)
ValueError: Unable to connect ArcGIS Online.
>>> 
0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Are you trying to log into ArcGIS Online or a local Portal instance?  What does the Portals section of ArcGIS Pro configuration look like?

When I try to log into a local Portal, the error specifically states the local Portal's address, not "ArcGIS Online"

0 Kudos
MarkCederholm
Occasional Contributor III

I have multiple Portal instances defined, including AGOL, never an issue in the past.  I removed all except the local one I want to use, and I still get the "Unable to connect ArcGIS Online" message.  Now here's an interesting development:  I can connect to AGOL and other Portal instances just fine using arcpy; it's just the one that's acting up.  I'll keep looking into it.

0 Kudos
MarkCederholm
Occasional Contributor III

I finally got it working.  It was an expired certificate, and I couldn't remember how to re-bind a new one.  Finally I found the directions.