Refreshing password on ArcGIS Server registered data store

457
2
04-15-2021 05:51 PM
SimonGIS
New Contributor III

Background:

Requirement:

As a sysadmin, I want to automate updating the database connection details in the ArcGIS Server data store settings, so that my services will continue to access the data in the database.

Challenges & Thoughts:

  • Preference to avoid arcpy, so that we can deploy script to Lambda. 
    • ArcGIS Python API or REST.JS can be used if required.

Q.1 Do you need Arcpy to create a .SDE file?

 

This Esri Script looks like it would meet my needs. 

  • Grabs the existing data items connection string
  • And then in step 6, update with new password

However, it makes no mention on how to encrypt the password.  

Q3. Where does the variable sample_1 come from in the linked python script?

SimonGIS_0-1618533294035.png

Q3. How do we encrypt the password?

Looking at the help for DataItem:

It is recommended that you encrypt the credentials using the encryption scheme before storing it into the server. This can be achieved by invoking Get Database Connection String tool inside the Publishing Tools toolbox published as a system service on the server.

This would indicate that there might be a step missing in the linked script.  Struggling to find much documentation/samples on how to use 'Get Database Connection String' without a SDE file?  

2 Replies
BillMitchell
New Contributor III

This issue appears to have been addressed via a GitHub issue: https://github.com/Esri/arcgis-python-api/issues/990.  However, the method for getting the SDE file path into the cloud environment is not entirely clear, nor is the original issue of how to create a function to update the password clarified.

0 Kudos
BillMitchell
New Contributor III

The step missing between 3 and 4 of the documentation is to create the SDE file, which requires the arcpy library's CreateDatabaseConnection function.

arcpy.management.CreateDatabaseConnection(out_folder_path, out_name, database_platform, instance, {account_authentication}, {username}, {password}, {save_user_pass}, {database}, {schema}, {version_type}, {version}, {date})

At this time, there is no method to directly generate the ENCRYPTED_PASSWORD, nor to do it without invoking the arcpy library.  I have created a related Enterprise Ideas post recommending that there should be one for exactly this use case.

0 Kudos