WARNING 001404: You are not signed in to ArcGIS Online

2216
11
12-20-2016 10:50 AM
CynthiaKozma
Occasional Contributor

I have a Python script that is run as a scheduled task every night.  It updates a service definition on AGOL using arcpy.UploadServiceDefinition_server.  When I first set this up, we had ArcMap 10.4 and Server 10.2.  To get around needing to be signed in to ArcGIS Online, I would sign into AGOL through ArcMap and just never sign out.  This got around the fact that arcpy.SignInToPortal_server no longer worked.  Recently, we upgraded Server to 10.4, so that all versions are the same.  Now, ArcMap automatically signs you out of AGOL every day, so when the script runs, it throws the error that you aren't signed in and the service definition never gets updated.  Is there any work around to this?  What is different about the Server being upgraded to 10.4 that made the change?  Any help is appreciated.

Tags (2)
0 Kudos
11 Replies
JoshuaBixby
MVP Esteemed Contributor

Does arcpy.SignInToPortal_server work now that everything has been upgraded to 10.4.x?  If not, what exactly isn't working with arcpy.SignInToPortal_server ?

0 Kudos
CynthiaKozma
Occasional Contributor

I have read that after 10.2, this is no longer valid code, and the only way to sign on is to manually go to File --- Sign In.  Before, I would do this and it would keep me signed in as long as I didn't sign out.  Now, it automatically signs me out as soon as ArcMap is closed.  This doesn't help with scripts run from scheduled tasks.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Where did you read that?  I am interested because arcpy.SignInToPortal_server still exists in ArcGIS 10.5.  I don't understand why it would be included 3 versions after it isn't valid.

0 Kudos
CynthiaKozma
Occasional Contributor

Really??  If it still works that would be great.  These are the things that I have found.....

This is from one google question/answer:

The {AGOL_Username} and the {AGOL_Password} Catalog Keys are used in conjunction with the arcpy.SignInToPortal_server function. Nevertheless, for ArcGIS 10.2 (and later) users, it could be necessary to comment out this part of the script as below:

And from the ArcGIS for Desktop Sign In to Portal help file:

Legacy:

Signing in to ArcGIS Online or Portal for ArcGIS through ArcGIS for Desktop has changed in the ArcGIS for Desktop 10.2 release. You may receive Warning 1561 when executing this tool. If you receive this message you cannot use the Sign In To Portal tool to authenticate, but must sign in to ArcGIS Online or Portal by clicking File > Sign In. See Signing in to ArcGIS Online in ArcGIS for Desktop applications for more information.

And last one:

At 10.2, significant enhancements were made to server security. To run this code at 10.2, comment out the arcpy.SignInToPortal_server() line (line 21). At 10.2, sign in information is obtained from the ArcMap File > Sign In dialog

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

You have to love the wiggle room, "You may receive Warning 1651...."  So, the tool may work, just not likely.

Unfortunately, our organizational workflows don't rely on this function, so I don't have anything more to add.  I guess the real interesting question is why are you being automatically signed out every day, and is there anything you can do about it.

Good luck.

0 Kudos
CynthiaKozma
Occasional Contributor

I liked that "may" part as well.  

I can't figure out why it won't stay signed in, but I will keep looking around.  Thanks for your help!

0 Kudos
GISDepartment9
New Contributor III

Hi,

I am running into the same problem where I get an error message stating I am not logged into ArcGIS Online.

I think I got it to work by leaving a blank map instance open that is logged into ArcGIS Online.

Then because its open it wont log you out and it technically is logged in because you logged in manually.

I know this might be cumbersome but its what I got to work.

I will just leave an instance of ArcMap open Monday night when the updates will happen.

I hope this helps!

0 Kudos
ScottStopyak
Occasional Contributor II

I tried to get around it by having a bat first open catalog then run my script. I had checked the sign me in automatically in the File>Sign In but for some reason it doesn't always work. There needs to be an arcpy equivalent for the tools esri is pushing out. I can easily open Pro and run Overwrite Web Layer but it's a manual process. It is unbelievable that esri is trying so hard to move everyone to hosted data but then wants me to reverse engineer tools they already have written for Pro. Is a simple arcpy.OverwriteWebLayer() too much to ask for?  Why is everything esri does half-baked nowadays?

0 Kudos
JamesCrandall
MVP Frequent Contributor

https://github.com/arcpy/update-hosted-feature-service/blob/master/update.py

We implemented this for our AGOL org account and it's still running just fine to update various Service Definition items (although we're migrating these off hosted more and more).

To compliment the AGOLHandler class we also employed the setttings.ini and base64 into the scripts to provide a little bit of security (it really just removes transparency and not really a complete secure solution) and does just fine for logging in/out of AGOL.

https://blogs.esri.com/esri/arcgis/2014/01/24/updating-your-hosted-feature-service-for-10-2/