Cannot log in with different ArcGIS Portal user account using ArcGIS Python API

1479
2
Jump to solution
12-31-2019 03:12 AM
ChrisBuckmaster2
New Contributor III

I have an ArcGIS Portal log in account (viewer account) in an enterprise GIS infrastructure and want to use the ArcGIS Python API to connect with a separate admin account to be able to produce reports on the ArcGIS Portal instance (layers being used in web maps, user last login stats etc).

When trying to connect using an admin account, it automatically connects with my viewer account (I am assuming my account is somehow automatically authorised within my network).

How am I able to explicitly log in with a different account using the ArcGIS Python API?

My script to connect is below:

from arcgis.gis import GIS
import getpass

password = getpass.getpass("Enter password: ")
gis = GIS("https://server/portal/home""admin_account", password)
print("Connected as: " + gis.properties.user.username + " on " + gis.properties.customBaseUrl)
print(gis.properties.user)
1 Solution

Accepted Solutions
GeoJosh
Esri Regular Contributor

Hey Chris,

Does your Portal use Integrated Windows Authentication? If so, try replacing the URL with the fully qualified domain name and port number. (https://portalMachine.domain:7443/arcgis/home) You should not be automatically authenticated as the viewer account when using this URL.

-Josh

View solution in original post

2 Replies
GeoJosh
Esri Regular Contributor

Hey Chris,

Does your Portal use Integrated Windows Authentication? If so, try replacing the URL with the fully qualified domain name and port number. (https://portalMachine.domain:7443/arcgis/home) You should not be automatically authenticated as the viewer account when using this URL.

-Josh

ChrisBuckmaster2
New Contributor III

Hi Joshua

Brilliant that worked!

I was using the URL path https://civvmi-esriapp1.unifiedgov.co.uk/portal/home/ but I changed it to https://civvmi-esriapp1.unifiedgov.co.uk:7443/arcgis/home/.

Clearly using 'portal' instead of 'arcgis' was an issue.

Thanks again