ArcGIS Online Blog

cancel
Showing results for 
Search instead for 
Did you mean: 

Other Boards in This Place

Latest Activity

(148 Posts)
GlenShepherd
Esri Contributor

Simple live-streaming (without ArcGIS Enterprise GeoEvent or GeoAnalytics Server roles) for public consumption

Read more...

more
4 2 244
BernSzukalski
Esri Regular Contributor

ArcGIS Living Atlas is a built-in, and ready-to-use, part of your ArcGIS Online experience, delivering basemaps, maps, layers, and app to support your work. 

ArcGIS Living Atlas is continually evolving, with updates and releases of new content happening all the time. The latest ArcGIS Living Atlas News (February 2021) delivers a summary of what's updated, new, and noteworthy since the beginning of the year.

View blog article

more
0 0 118
BernSzukalski
Esri Regular Contributor

For many of the Census  Bureau American Community Survey (ACS) Living Atlas layers, there is now a corresponding 2010-2014 boundaries layer, symbolized using the same color ramp and breakpoints for a clear comparison. @DianaLavery1 and @StevenAviles show you how to reveal trends over time using these layers. For details, see Reveal demographic trends over time with American Community Survey Layers in Living Atlas.

more
1 0 87
BernSzukalski
Esri Regular Contributor

@AndrewSkinner delivers a blog article covering his work on a dark, accessible basemap that is WCAG compliant. Read more in Towards a DARK accessible basemap.

more
2 0 93
BernSzukalski
Esri Regular Contributor

A lot of things happened in ArcGIS Online and related products during this past year. There's a lot that you may have overlooked or forgotten. This summary blog article covers the highlights, with links to details. Also, check out the 2020 ArcGIS Living Atlas year in review blog article.

Read more...

more
1 0 130
MikeSchoelen
Esri Contributor

Does your ArcGIS Online attribute table contain HTTP URLs? Check out this script that converts HTTP links into HTTPS, if that site uses HTTPS. It also updates any URLs that may be redirecting to a new webpage!

Read more...

more
1 0 120
LynnaeTerpstra
Esri Contributor

In one week, ArcGIS Online will be enforcing HTTPS Only. Any remaining HTTP Only URLs will become inaccessible, so make sure to update your items to HTTPS!

Read more...

more
1 0 153
PeterKnoop
Occasional Contributor II

Collaborating in ArcGIS Online is a confusing and burdensome process, how could it be improved?

Read more...

more
5 3 672
MatthiasSchenker
Esri Contributor

Configure your options and secure your ArcGIS Online activity

This webinar will focus on helping organizations with strict security, compliance, and privacy obligations. We will explain ArcGIS Online configuration options and best practices, explore the need for processes and pipelines to govern information delivery, and demonstrate tools to help regularly monitor the security and sharing status of both ArcGIS Online items and the ArcGIS Online organizational account as a whole. We will also introduce and discuss Esri’s product security incident response team and discuss Esri’s incident response process.

Webinar Takeaways

In this webinar, developers will learn more about

  • security and privacy checklist
  • ArcGIS Security Advisor
  • customer governance responsibilities

more
0 0 161
Peter_Klingman
Esri Regular Contributor

Scripts that use the ArcGIS API for Python to accomplish any automated task within ArcGIS Online usually need to connect to the ArcGIS Online organization first. The easiest way to do this is to hardcode your password into the script. Any of us who have worked with the ArcGIS API for Python are familiar with these ubiquitous lines:

from arcgis.gis import GIS
gis = GIS("https://arcgis.com", "Username", "Password")‍‍‍‍

However, the reality is that hardcoding passwords into scripts is a security risk for a number of reasons. One of the most common risks is the propensity to mistakenly share a script to a public repository or with colleagues that still contains your embedded password. Thankfully, there are multiple approaches for authenticating to the GIS that remove the password from the script and do not require any sort of login prompt (meaning they can run automatically without human interaction to type a password). 

Option 1: Store your credentials to a profile

This is recommended in the API guide. The profile parameter uses the keyring library to store your username in an unencrypted config file and securely store your password in the operating system's password manager. Once you set the profile, you can log in using just the profile name, referencing the credentials stored in the config file and password manager associated with that specific profile. The sample below shows how to get started:

### Set up a profile
from arcgis.gis import GIS
gis_profile = GIS("https://arcgis.com", "my_username", "my_password", profile="Esri Support Admin")
print("Profile defined for {}".format(gis_profile))‍‍‍‍‍‍‍‍‍‍‍‍
Profile defined for GIS @ https://<myOrg>.maps.arcgis.com version:8.3

Now that we've established the profile, we can connect to the GIS using only the profile parameter:

### Log in with a profile
from arcgis.gis import GIS
gis = GIS("https://arcgis.com", profile="Esri Support Admin")
print("Connected to the GIS as {}.".format(gis.properties.user.username))‍‍‍‍‍‍‍‍
Connected to the GIS as my_username.

Option 2: Directly access keyring to store your password

Keyring is installed in the ArcGIS Pro default Python environment and can be used to securely store a password in the operating system's password manager. 

The concept is similar to setting a profile and accessing it later. The first step is to set the password, and optionally verify that the password has been stored as you expect. ArcGISOnline is set as the argument for the system parameter, used to keep track of which passwords go with which usernames. 

### Set password and optionally verify storage
import keyring
keyring.set_password("ArcGISOnline", "my_username", "my_password")
#Optionally verify password storage
pw = keyring.get_password("ArcGISOnline", "my_username")
print(pw)‍‍‍‍‍‍‍‍‍‍‍‍
my_password

With the password set, you can use the get_password() method to retrieve the needed password from the operating system's password manager to sign into the GIS. Since we set ArcGISOnline as the system in the code above, we'll need to use it to retrieve the correct password:

### Access the stored password with keyring and sign into the GIS
from arcgis.gis import GIS
import keyring
pw = keyring.get_password("ArcGISOnline", "my_username")
gis = GIS("https://arcgis.com", "my_username", pw)
print("Connected to the GIS")‍‍‍‍‍‍‍‍‍‍‍‍
Connected to the GIS

Option 3: Use the active ArcGIS Pro connection

Connecting to the GIS using the active ArcGIS Pro connection is also covered in the API Guide. No credentials are required; you just need to make sure ArcGIS Pro is on your machine and you are connected to the intended ArcGIS Online organization. The really advantageous part about using the Pro connection is that it works with SAML logins; so if you need to automate a script that requires authentication and don't have/do not want to use built-in users, this method is the way to go. To leverage the Pro connection without ArcGIS Pro concurrently running, you'll need to select "Sign me in automatically" when connecting to organization in ArcGIS Pro or take your license offline.

### Use the active Pro connection
### This example uses a SAML login
from arcgis import GIS
gis = GIS("Pro")
print(gis)‍‍‍‍
GIS @ https://<myOrg>.maps.arcgis.com/ version:8.3

--------------------

I hope you found these tips helpful for securely automating authentication using the ArcGIS API for Python! Thanks for reading, and please let me know any feedback in the comments below. 

more
4 0 1,195
Labels