HOW TO

Assign portal item ID to a republished map service in another ArcGIS Enterprise environment

Last Published: December 22, 2025

Summary

Some organizations require portal item IDs to remain consistent when migrating content across ArcGIS Enterprise environments such as development, staging, and production. ArcGIS API for Python provides the clone_items() method, which supports preserving item IDs in ArcGIS Enterprise 10.9.1 and later through the preserve_item_id parameter. However, the clone_items() method does not support cloning map services. Refer to ArcGIS API for Python: Cloning Content for more information. Due to this limitation, organizations must republish the map service in the target environment. When a service is published, Portal for ArcGIS automatically creates a new portal item with a new item ID.

Note:
Portal for ArcGIS does not allow modifying the item ID of existing items, as described in the article, FAQ: Is it possible to change the item ID of existing items in Portal for ArcGIS?.

This article provides the steps to add a new portal item with the desired item ID to Portal for ArcGIS and update the map service's portalProperties in the ArcGIS Server Administrator Directory so that the service references the desired item ID.

Procedure

Note:
Prerequisites to performing this workflow: • Administrator privileges are required in both the Portal for ArcGIS and ArcGIS Server target environments. • The user must have permission to publish services to ArcGIS Server. • The desired (source) portal item ID must be known before beginning the workflow. • ArcGIS API for Python must be installed and configured in ArcGIS Pro or a Python environment.
  1. Publish the map service to the target environment. Refer to ArcGIS Pro: Publish a map service for the ways to publish a map service.
  2. Manually create a new portal item with the desired item ID (same item ID as the source portal) using ArcGIS API for Python. Use the ContentManager.add() method to create a Map Service type portal item that references the published map service URL. Specify the map service URL of the target environment and the desired item ID (same as the source portal). For example:
from arcgis.gis import GIS

# Connect to the target portal
gis1 = GIS("https://<machinename>/portal", "<username>", "<password>")

# Create the new portal item that points to the existing map service
gis1.content.add(
item_properties={
"type": "Map Service",
"title": "<exampletitle>",
"url": "https://<machinename>/server/rest/services/<servicename>/MapServer"
},
item_id = '<desired item ID>') # desired item ID from source portal
  1. Log in to ArcGIS Server Administrator Directory as an administrator.
    1. On the Site Root - / page, for Resources, click services.
    2. On the Folder - / page, under Services, click the map service.
    3. At the bottom of the map service page, for Supported Operations, click edit.
    4. On the Edit MapServer page, locate the itemID and replace the original with the desired item ID. For example:
"portalProperties": {
"isHosted": false,
"portalItems": [{
"itemID": "<desired item ID>",
"type": "MapServer"
}]
},
  1. Click Save edits.
  1. Log in to Portal for ArcGIS and verify that the manually created portal item with the desired item ID loads successfully and references the correct map service URL.
  2. Delete the portal item generated in Step 1.

Article ID: 000030927

Software:
  • Portal for ArcGIS
  • ArcGIS Server
  • ArcGIS API for Python

Get support with AI

Resolve your issue quickly with the Esri Support AI Chatbot.

Start chatting now

Get help from ArcGIS experts

Contact technical support

Start chatting now

Go to download options