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)