Use Python To Sign in to ArcGIS Online and a Local Portal

4413
2
10-02-2014 08:57 AM
Drew
by
Occasional Contributor III

Hello,

I would like to use arcpy to share a map package (.mpk) in both ArcGIS Online and our local Portal.

I have been testing the SignInToPortal_server (username, password, portal_url) function but the 'portal_url' parameter seems meaningless (see bold text in the below documentation).

Docs for portal_url paramater

The Sign In To Portal tool reads the URL set in Desktop Administrator. Any user entered value is ignored. The default value is URL for the ArcGIS portal currently chosen by the user in Desktop Administrator.

Basically I would like to do the below but I can not get around the settings pre-stored in Desktop Administrator....

    arcpy.SignInToPortal_server("username","password", "http://www.arcgis.com/")

    # TO DO ->: Upload Map Package to ArcGIS.com

    arcpy.SignOutFromPortal_server()

     arcpy.SignInToPortal_server("username","password", "http://www.myLocalPortalURL.com/")

    # TO DO->: Upload Map Package to Local Portal

    arcpy.SignOutFromPortal_server()

Any ideas on how to change my portal URL programmatically?

Andrew

Tags (1)
0 Kudos
2 Replies
ElleryChan
New Contributor II

This does not really answer your question.  But as a workaround, can you just set up another username bound to the alternate URL?  The docs do seem to say that the third parameter is completely ignored.

0 Kudos
Drew
by
Occasional Contributor III

Thanks for the suggestion Ellery, but unfortunately no matter what I do the function always seems to call the connected portal defined in ArcGIS Administrator (as seen in Fiddler).  I think I will be exploring the REST API or ArcObjects to accomplish this.

Andrew

0 Kudos