Select to view content in your preferred language

Reset all user credits, transfer Experience Builder app to a new organization, delete all users... - Building Administrative Scripts in ArcGIS Online

108
0
yesterday
Labels (1)
BrianBaldwin
Esri Regular Contributor
1 0 108

There are a lot of tasks that administrators need to deal with in ArcGIS Online related to users. Adding licenses, updating credits, deleting users, etc. Many of these actions can be completed through the UI, but when you are trying to manage hundreds or thousands of users, a lot of those actions can be really tedious.

The ArcGIS Python API has included administrative functionality for a long time now and many users have created scripts to help automate their work. Yet, if you have not yet tested the ability to build scripts using your preferred large language model (LLM)… now would be the time.

The workflow that I really enjoy, is creating and saving these scripts in the ArcGIS Online Notebook environment. Right within ArcGIS Online, you have a fully featured Python Notebook environment, you just need to open it up!

BrianBaldwin_0-1786469142848.png

 

You also have the ability to schedule any notebooks that you host in ArcGIS Online. If I want to build a daily report that sends me an e-mail of usage, or credit consumption, I could set that up.

For any of these scripts, the advice I would provide is that you iterate with smaller tasks or steps. You will have the best success this way. Also, ensure that you provide some guardrails in the opening statement/prompt. A rather simple one that I have been using is:

Use only Esri documentation and best practices found through Esri blogs, websites, documentation, and resources. Do not make up a solution. Find the simplest way to implement the solution.

Here are a few of the recent scripts that I have built out and tested. Many of these took a few iterations to fix errors, etc. Please take these and use them, or more likely, I hope they inspire you to build your own scripts!

Hopefully it goes without saying… but with great power comes great responsibility. When you log into ArcGIS Online as an administrator, you COULD run a script that permanently deletes all content and users in your organization. So, make sure that you know what you are doing and please TEST any scripts prior to running them in your production organization.

Reset Credit Budget by Role

This script looks at a comma separated list of roles and then assigns X credits to that role.

Migrate Tagged Content to New ArcGIS Online Organization

This script looks for a specific tag on a high-level item (an Experience Builder application) and then transfers all the content and dependencies to a new organization. If there are layers that are not owned by the user (Living Atlas data, etc.), that content will be referenced.

Bulk Apply Tags and Categories to Users from Uploaded CSV

This notebook loads a CSV exported from your Learning Management System (LMS), matches users by unique ID against your ArcGIS Online organization, generates a pre-flight summary report, and — only after your confirmation — applies the specified tag and category to matched users.

Close

I would LOVE to see other scripts or ideas that administrators have. What issues are you looking to automate? Do you have something that others should know about? Please share!

Contributors
About the Author
Brian works as a Lead Engineer at Esri to support customers in Education. Brian has worked as a lecturer in GIS, supported non-profits through his community planning work, and honestly just loves working with users to help solve their geospatial quandaries!