0

I'm currently signed into my portal through ArcGIS Pro. When I want to use a python notebook to update my portal, I use:

from arcgis.gis import GIS
my_gis = GIS(
             url='https://<my Org's URL>', 
             cert_file = <path to cert>, 
             password = <my password>, 
             username='ANY'
             )

Since I'm already signed into my Portal in ArcGIS Pro, is there a way that I can automatically pass it my password?

It doesn't seem to need a username; I just pass in 'ANY'.

2 Answers 2

1

Yes, there is a specific authentication scheme just for ArcGIS Pro

print("\n\nActive Portal in ArcGIS Pro")  
gis = GIS("pro")
2
  • Doesn't seem to work for me; it might not like that I have a certificate. Jul 15 at 20:18
  • @SwiftestKoala I'd suggest adding more information to your question, like the exact error you're getting, which version of the Python API. You said you're using a Notebook in the question, in another comment you mention wanting to do this in a toolbox. Have you tried other authentication types from the link I posted?
    – KHibma
    Jul 19 at 11:53
0

You can use the SignInToPortal function to sign in to your ArcGIS Pro portal :

import arcpy

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

You may also need to look at Connect to the GIS in Python scripts without embedded passwords or login prompts in the Esri community.

2
  • The OP is using the ArcGIS Python API. You still need to hydrate the GIS object with a connection. Logging into Portal via the arcpy tool will not do that.
    – KHibma
    Jul 18 at 13:12
  • This. I want to make a toolbox that will allow a user to update portal items. The goal is that the username and password won't need to be hardcoded anywhere; all the user has to do is sign in. Jul 18 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.