arcpy licensing with ArcGIS Pro/Portal when using service account

732
2
Jump to solution
12-10-2019 02:49 PM
Arne_Gelfert
Regular Contributor

I have been trying to move off Python 2.7 and rewrite my scripts in Python 3.6 that shipped with ArcGIS Pro. So far no real upsets as long as I'm the one running the script. (I'm licensed for Pro.)

But when I try scheduling a script with Task Scheduler via batch file using a service account on a server, the script dies. 

When I run python cmd as service account and then try "import arcpy", I get:

Interesting ... but makes sense that arcpy requires licensing. So since I have Pro on the same box, I tried that and also get a licensing message  - "A core license could not be found...".

I see there is a way to log in to Portal in Python... 

arcpy.SignInToPortal(arcpy.GetActivePortalURL(), 'username', 'password')

But I guess my service account first needs a Portal account. When I try to grant that as Portal Admin, I get :

One or more members are missing an email address and will not be added.

Oh c'mon!!! So do I now have to request an email address for my service account? Or is there another way to make this work? Help!

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
Arne_Gelfert
Regular Contributor

Okay, so you hate to answer your own question because it just proves you either didn't think through the question carefully before posing it or you were just too lazy to try and answer it yourself instead of wasting everyone else's time by asking them. In my defense I can only say that sometimes spelling out the question helps me phrase it properly in my mind and gets the investigative, inquisitory juices flowing.

So while I wasn't able to create a user for my service account in Portal ('Add Members' isn't really intended for that), I was able to so in the Portal admin interface. All I did was create an admin user here, then I could grant that user 'Admin' status in Portal under Organization, plus Level 2 status, and a Pro license. Could be that was overkill. But at least it now allows the account to import arcpy in Python 3.6 and execute my script. 

View solution in original post

2 Replies
Arne_Gelfert
Regular Contributor

Okay, so you hate to answer your own question because it just proves you either didn't think through the question carefully before posing it or you were just too lazy to try and answer it yourself instead of wasting everyone else's time by asking them. In my defense I can only say that sometimes spelling out the question helps me phrase it properly in my mind and gets the investigative, inquisitory juices flowing.

So while I wasn't able to create a user for my service account in Portal ('Add Members' isn't really intended for that), I was able to so in the Portal admin interface. All I did was create an admin user here, then I could grant that user 'Admin' status in Portal under Organization, plus Level 2 status, and a Pro license. Could be that was overkill. But at least it now allows the account to import arcpy in Python 3.6 and execute my script. 

DanNarsavage_IDWR
New Contributor II

I'm in the throes of exactly the same problem, and I had considered doing what you said, except that our Pro licensing comes via AGOL not Portal.  But this burns a named user just to automate some basic data maintenance tasks. Is there really no better way?

I also considered logging in as the service account on the machine where the task is run and opening Pro using *my* credentials. That seems like it may violate some terms of use, but my main concern here is that I'd like my stuff to keep working after I leave my current employer and they reassign my license.

0 Kudos