I want to automate a workflow I have in ArcGIS Pro using arcpy.
I am running the Near tool against two secured Portal services within ArcGIS Pro. Everything works well when running it through ArcGIS Pro - I simply run the tool and it successfully updates the secured services.
When I try to automate it I copy the Python snippet for the tool. This is where I run into problems. Naturally within the ArcGIS Pro environment, the layer names have a context as they reference a specific layer (with defined definition queries) within a map within a project. When in an isolated Python environment this context is lost along with the Portal connection.
My question is how can I replicate these within a Python environment? I have seen URL's being used as tool inputs, but these don't honor the definition queries, nor do they take care of authentication.
Thanks for any suggestions and insight.