The SignInToPortal function allows you to sign in to a portal.


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.


SignInToPortal (portal_url, username, password)
ParamètreExplicationType de données

The URL of the portal to be signed in to.


The user name of the user signing in to the portal.


The password of the user signing in to the portal.

Valeur renvoyée
Type de donnéesExplication

A dictionary of key value pairs for expires, referer, and token.

Exemple de code

SignInToPortal example
import arcpy

arcpy.SignInToPortal(arcpy.GetActivePortalURL(), 'username', 'password')

Rubriques connexes