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>, 

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


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

print("\n\nActive Portal in ArcGIS Pro")  
gis = GIS("pro")
  • Doesn't seem to work for me; it might not like that I have a certificate. Commented Jul 15, 2022 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
    Commented Jul 19, 2022 at 11:53

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.

  • 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
    Commented Jul 18, 2022 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. Commented Jul 18, 2022 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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