You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Data Store Database Password Update via Portal #2527
Describe the bug
The following script works for registered databases, as long as they have not been created as an item in Portal. https://support.esri.com/en-us/knowledge-base/how-to-programmatically-update-a-password-change-in-an--000022551. If a Portal item exists, management is required via the Portal item rather than arcgis/admin/data/item/enterpriseDatabases//edit which returns "The data store item can only be managed via Portal". Following the steps in the KB, ds.update() returns False. Attempts to update the Portal item result in the Portal item being updated, but not the Server datastore.
To Reproduce
Register a database. This can be done through ArcGIS Pro (which natively creates a Portal item), or through Manager and then clicking the Create Item button (user profile icon)
Follow steps in above KB article
Observe the ds.update() returns False
Attempt to update the Portal item
item=gis.content.get(<item_id>)
print(item.get_data())
# Replace the connectionString with what was generated from the KB stepsnew_data= {"path", "type", "connectionString", etc...}
item.update(data=new_data)
Navigate to the Portal item and settings. View that the Database Connection section shows the updated connectionString info, but the Server section no longer validates.
Navigate to the datastore item in arcgis/admin. View that the connectionString does not match what was updated in Portal.
Screenshots
If applicable, add screenshots to help explain your problem.
Expected behavior
Successful update of datastore when Portal item exists and management is required via Portal.
Platform (please complete the following information):
@djantz’s note about PortalDataStore.refresh_server is the missing sync step. Server Admin /edit (KB 000022551) is blocked when the datastore is Portal-managed, and item.update(data=...) alone does not push credentials to federated servers.
I put a temporary hotfix on my fork that:
Updates the Portal Data Store item info.connectionString
Calls gis.datastore.refresh_server for each registered server
Optionally validates afterward
Optionally monkey-patches Datastore.update so KB-style scripts fall back to that Portal path when Server returns “managed via Portal”
Try this and let us know if the results are what you are expecting.
fromarcgis.gisimport (
GIS,
ItemProperties,
ItemTypeEnum,
SharingLevel
)
fromutils.loggingimportenable_verbose_loggingenable_verbose_logging()
# connect to the ArcGIS Enteprise portal using the GIS classgis=GIS(
url="https://organization_url.com/webadaptor_name",
username="<ORG_ADMIN_USERNAME>",
password="ORG_ADMIN_PASSWORD"
)
# use the federation to get Server ids for the # hosting server in the organization's federationservers_dict=gis.admin.federation.serversserver_list=servers_dict["servers"]
host_id= [srvr["id"] forsrvrinserver_listifsrvr["serverRole"] =="HOSTING_SERVER"][0]
# use the ServerManager to get the hosting server Server object and use the datastores# property to get that Server's DatastoreManagerhost=gis.admin.servers.get(role="HOSTING_SERVER")[0]
host_dsmgr=host.datastores# assign a variable to the path of the database connection file# with the updated credentialsconn_file_upd=r"/path/to/the/updated/credentials file/updated_egdb_file.sde"# use the server's DataStoreManager to generate a connection string for the database connection fileconn_string=host_dsmgr.generate_connection_string(conn_file_upd)
## create the text parameter for the updated datastore item's text argument## see https://developers.arcgis.com/rest/enterprise-administration/server/data.htm## see https://developers.arcgis.com/rest/enterprise-administration/server/dataitem.htmtext_param= {"info": {"isManaged": False,
"dataStoreConnectionType": "shared",
"connectionString": conn_string},
"type": "egdb",
"path": "/enterpriseDatabases/sql_server_datastore_item"}
# create an ItemProperties object to use for updating the existing datastore # item. Make sure to use the text parameter whose argument is the data item# dictionary defined in the step aboveitem_props=ItemProperties(
title="SqlServer dev0016118 Item API",
item_type=ItemTypeEnum.DATA_STORE,
tags= ["api_created", "datastore_item" ,"bulk_publishing"],
snippet="Adding a datastore item to use api for management.",
text=text_param,
)
# use the ContentManager to get the existing datastore item's idds_item=gis.content.get("<datastore item id>")
# use the update method with the new ItemProperties object to update the # existing datastore item with the new credentialsds_item.update(
item_properties=item_props
)
# Get an instance of the PortalDataStore object to manage the datastore itemp_ds=gis.datastore# validate the data store item can be connected to before registeringvalidation_state=p_ds.validate(
server_id=host_id,
item=ds_item
)
# refresh the datastore information on the server side p_ds.refresh_server(
item=ds_item,
server_id=host_id
)
# share the datastore item with the organizationds_item.sharing.sharing_level=SharingLevel.ORG
Activity
djantz commentedon Jul 16, 2026
Just stumbled on this which seems to be the missing "link" between Portal item and Server https://developers.arcgis.com/python/latest/api-reference/arcgis.gis.toc.html#arcgis.gis._impl._datastores.PortalDataStore.refresh_server
If this checks out, updating the KB with reference to this would be helpful and this bug may be closed.
kgalliher commentedon Jul 16, 2026
@jyaistMap @achapkowski
kyroskoh commentedon Aug 13, 2026
Workaround: Portal item update +
refresh_server@djantz’s note about
PortalDataStore.refresh_serveris the missing sync step. Server Admin/edit(KB 000022551) is blocked when the datastore is Portal-managed, anditem.update(data=...)alone does not push credentials to federated servers.I put a temporary hotfix on my fork that:
info.connectionStringgis.datastore.refresh_serverfor each registered serverDatastore.updateso KB-style scripts fall back to that Portal path when Server returns “managed via Portal”Docs (README): https://github.com/kyroskoh/arcgis-python-api/blob/fix/issue-2527-portal-datastore-password/misc/tools/issue_2527/README.md
Branch: https://github.com/kyroskoh/arcgis-python-api/tree/fix/issue-2527-portal-datastore-password
Code:
misc/tools/issue_2527/When Esri releases a fix
After upgrading to a fixed ArcGIS API for Python (or when a first-class update-password API ships):
apply(...)/update_password(...)imports and calls from your scripts.misc/tools/issue_2527/(or stop using this fork branch) so the hotfix is not reapplied by mistake.This approximates the Portal UI Update Password flow (Manage data store items). Full usage, limits, and references are in the README. Related community idea: https://community.esri.com/t5/arcgis-enterprise-ideas/expose-database-datastore-item-update-password-to/idi-p/1701215
Document Esri#2527 Portal datastore password workaround in README.
Document unapply/removal steps for Esri#2527 workaround after Esri fix.
Add mock/smoke tests for Esri#2527 Portal datastore password workaround.
kgalliher commentedon Aug 13, 2026
Try this and let us know if the results are what you are expecting.