Hi All - I'm trying to set up a SQL Agent job step (pics below, SQL 2016) that runs a .py geoprocessing script built using Pro (3.6.5) on our test server. So far, the job step only works IF I specify my Windows AD account as the SQL Agent Service Logon. However, our group needs to run these using a common AD account OR by using the combination of a Local System Account (as Logon) and SQL Agent Proxies...I have tried running this scenario with Pro set as Single Use, Named User, Authorized for Offline Use, Signing In Automatically, etc. ArcGIS Pro (2.2.1) was admin-installed for all users on the server and the script (.py) runs successfully when called in Task Scheduler, IDLE, other environments etc. My guess is that the job step fails on "import arcpy" because I'm getting successful print messages from the script before that line occurs.
Any assistance or suggestions appreciated!
-Nick
Job History Error:
"...import arcpy File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 72, in <module> from arcpy.geoprocessing import gp File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\__init__.py", line 14, in <module> from ._base import * File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 14, in <module> import arcgisscripting RuntimeError: Not signed into Portal. Process Exit Code 1. The step failed...."
Out of curiosity did you figure this out? I'm in a similar situation where I'm trying to run a python script when not logged into the server. Instead, the script is invoked by By a Windows Service run by the 'Local Sytem' account. The script fails when importing arcpy with an error of 'Not signed into Portal'.
Hi Shane - I haven't worked this out yet, but I had to move on to some other projects. Using Task Scheduler & Python based job failure notification (email) has been the present workaround....
I figured out how to use an AD service account without having to use the Task Scheduler. I had to
While I do not know the exact mechanism used to validate a license when importing arcpy (neither does anyone I've talked with at ESRI either), it seems 'C:\Users\SomeUser\AppData\Local\ESRI\ArcGIS Pro' must have already been created. The steps above create the directory and files necessary to gain a license of Pro.
If you then use the service account to run your SQL Agent job it should successfully import ArcPy, eliminating the 'Not signed into Portal' error. I'm able to kick off ArcPy scripts using a Windows service running under an AD service account using these steps.
Hi Shane - That helped to corroborate the use of my own AD account and named user. Thanks so much for replying. Apologies for returning to this months later....Right now we have opted (for our team's situation) to use one of our Single Use ArcGIS Pro licenses (no sign in). We had IT set up a single AD user to run our nightly SQL jobs using this Single Use license. The user is specified as the SQL Agent logon (see this article) + other limited SQL objects for running jobs, etc. Our beta Pro-based python jobs are running w/out being logged in, off-hours, etc...So far, so good. Anyway, hope this helps others.
thanks!
-Nick