I have a web tool that uses both arcpy and Python API. The arcgis.gis.GIS object correctly sees the user of the web tool, but arcpy sees the owner of the ArcSOC process. I would like arcpy to sign into Portal as the web tool user [so that layers in a Pro project will be visible, which I don't want to share with Everyone]. Is there any way to do this?
Solved! Go to Solution.
I ended up creating a special account and storing the encrypted password. I'm not incredibly happy with that approach, but it at least prevents hard-coding credentials.
Hi Mark,
As far as I know, you can not do it. You can try to create a 'proxy account' on your portal. Share the content with that user. Finally, hardcode/hash/upload from extrenal ressource its credentials in arcpy using:
https://desktop.arcgis.com/en/arcmap/10.7/tools/server-toolbox/sign-in-to-portal.htm
BR,
Adam
I ended up creating a special account and storing the encrypted password. I'm not incredibly happy with that approach, but it at least prevents hard-coding credentials.