PROBLEM
Attempting to log in to ArcGIS Online using ArcPy sometimes fails, and returns the following warning message:
Warning: 001561: ArcGIS Online/Portal authorization requires direct sign in
The following shows a sample failed script:
import arcpy userName = "user1" passWord = "password1" # For ArcMap arcpy.SignInToPortal_server(userName, passWord, "http://www.arcgis.com/") # For ArcGIS Pro arcpy.SignInToPortal(arcpy.GetActivePortalURL(), 'username', 'password') print arcpy.GetMessages()
There are two possible causes:
Add the portal_url value in ArcGIS Administrator.
After adding the portal_URL parameter in ArcGIS Administrator, the syntax in the SignInToPortal tool for ArcMap is empty, as shown below.
arcpy.SignInToPortal_server(userName, passWord, "")
To run the code outside of ArcGIS Pro or ArcMap, the following conditions must be met:
Get help from ArcGIS experts
Download the Esri Support App