Pass AD Login from arcgis to arcpy

1518
5
01-23-2020 01:20 PM
TedCronin
MVP Honored Contributor

Is there a way to pass my AD login from arcgis to arcpy?  The arcpy package only supports built in accounts, and I want to only have 1 account per each of my users in enterprise/agol.  Currently, have built in for running arcpy, and for arcgis can use either enterprise login or a built in with arcgis.  For a lot of my tasks, I only need arcpy, but wish to utilize the enterprise login support from arcgis.

5 Replies
TrevorNickolai
Esri Contributor

Hey Ted,

It is possible to do what you seek.  This document can help with getting your Python API set to utilize authentication methods other than built-in: Working with different authentication schemes | ArcGIS for Developers 

OAuth2.0 = Enterprise Logins/SAML.  I hope the documentation is helpful for you.

0 Kudos
TedCronin
MVP Honored Contributor

The doc is using the arcgis api with other authentication methods, I want to pass that arcgis login to arcpy and use arcpy in my work, not use arcgis.  I am just wanting to use the AD login from arcgis, since arcpy does not have a way to use AD accounts to authorize.  

0 Kudos
WengNg2
New Contributor III

Hi,

I'm experiencing the same issue. There is no support for Enterprise login using OAuth2.0 via ArcPy. 

We use Arcpy to overwrite feature layers to automate the refresh but because it doesn't support Enterprise Login via ArcPy, I need to sign in manually and check the 'Sign In Automatically' option in ArcGIS Pro.

However, for whatever reason, sometimes the user gets signed out of ArcGIS Pro which causes the script to break. 

Would be great if there is an option for me to pass a token of some sort through ArcPy.

arcpy.SignInToPortal(arcpy.GetActivePortalURL(),token='')

 

0 Kudos
meloking_PNM
New Contributor III

Any update on this issue? I'd also like to leverage oauth/tokens for arcpy and I'm not seeing it in the documentation anywhere. 

0 Kudos
WengNg2
New Contributor III

I think we're out of luck :

https://community.esri.com/t5/arcgis-pro-ideas/support-for-enterprise-login-in-arcpy/idc-p/1154985#M...

It is up to ESRI to provide a better auth mechanism in Arcpy for users using SAML. 

You either use a built-in account of the sign-in manually via ArcGIS Pro.

0 Kudos