Summary
The SignInToPortal function allows you to sign in to a portal.
Discussion
To share content or run Ready To Use Tools, you must be signed into a portal. Your portal can be either ArcGIS Enterprise or ArcGIS Online.
To add a portal connection, click the Project tab on the ribbon and click the Portals page.
SignInToPortal will add the portal URL to your portal connections, if not already included, sign in, and set the portal to active. If executed in the Python window, the portal will be set as the active portal, if different, and add it to the portal connections for future ArcGIS Pro or stand-alone Python sessions. However, if executed in a stand-alone Python session, the portal information is used only for the duration of the active Python session.
Only portal users or accounts based on built-in security are supported; username and password are required parameters.
Syntax
SignInToPortal (portal_url, username, password)
Parameter | Explanation | Data Type |
portal_url | The URL of the portal to be signed in to. | String |
username | The user name of the user signing in to the portal. | String |
password | The password of the user signing in to the portal. | String |
Data Type | Explanation |
Dictionary | A dictionary of key value pairs for expires, referer, and token. |
Code sample
import arcpy
arcpy.SignInToPortal(arcpy.GetActivePortalURL(), 'username', 'password')