Skip To Content

Scripting Portal for ArcGIS administration

In this topic

Scripting your Portal for ArcGIS administration allows you to execute common tasks at scheduled times and automate them if desired. It also reduces the chance of making mistakes when performing a complicated or repetitive task. Typical administration workflows that benefit from scripting include:

  • Managing portal membership, such as adding or removing users from the portal and adding or removing users from portal groups.
  • Managing portal items, such as sharing items with groups, updating item properties (for example, tags), and bulk updates to the URLs of a map service in web maps.

All administrative tasks in the portal are ultimately executed through the ArcGIS REST API. The API can be invoked from any scripting or programming language that can make HTTP requests.

Portal for ArcGIS includes ready to use command line utilities and Python scripts to help you get started with scripting the administration of your portal. By understanding how the ArcGIS REST API works, you'll be able to expand on the provided samples and create your own scripts.

If you want to automate setting up the entire web GIS (Portal for ArcGIS, ArcGIS Web Adaptor, ArcGIS for Server, ArcGIS Data Store, and SSL certificates), you can use a Chef Cookbook. For example, if you are a consultant and set up sites for your clients, scripting the setup would simplify your work.

Portal for ArcGIS command line utilities

A small set of command line utilities are included to help you perform common administrative tasks. The utilities must be run on the machine hosting the portal. They are ready to use and do not require any programming knowledge. See Portal for ArcGIS command line utilities for details.

Sample Python scripts

Portal for ArcGIS includes some sample Python scripts that expand on the capabilities provided through the command line utilities. Unlike the command line utilities, you can run these scripts from any machine that has been configured with the Python environment. The scripts have been written so you can run them easily with minimum knowledge of Python. These scripts can be executed as is, or you can also use them to learn how to interact with the REST API, customize them, or even create your own. See Sample Python scripts for details.


PortalPy is a Esri Python module that helps you streamline the creation of complete administrative tasks. PortalPy provides a collection of high level Python classes that hide the complexities of working directly against the REST API. Using PortalPy requires some level of Python programming knowledge, but provides the most productive environment for automating the administration of your portal. As with the Python sample scripts, you can access the source code to extend PortalPy if desired. See Scripting administrative tasks with PortalPy for details.

The ArcGIS REST API and its relationship to Portal for ArcGIS

The ArcGIS REST API includes resources and operations for administering Portal for ArcGIS. You can invoke every administrative task that the portal supports through the API. In fact, all administration tools provided with ArcGIS, including ArcGIS for Desktop and the Portal for ArcGIS website, leverage this API.

The API can be invoked from any language that can make a web service call, such as Python, Java, JavaScript, PowerShell, C#, Ruby, Scala, Perl, and others. Examples provided in this help use Python. You do not need any Esri software installed to run a script that uses the API.

To learn more, see Scripting with the ArcGIS REST API.

Chef Cookbooks

Esri provides a Chef Cookbook you can use to automate ArcGIS software installation and configuration. Use it to install Portal for ArcGIS, ArcGIS for Server, ArcGIS Web Adaptor, and ArcGIS Data Store and configure them to work with each other. To get started, follow the steps in the Getting Started.txt file. You can download this tool from Esri GitHub or the Chef Supermarket. When you run the tool, provide information specific to your site. More advanced Chef users can customize the Cookbook before using it.