I'm working on a python script to upload a sddraft xml file from ArcGIS Pro to a standalone 10.7 arcgis server that would enable the "Shared Instances" option on the service. So far, everything works, but when I enable the settings to allow shared instances, the map service throws some errors while publishing.
The script modifies the xml document to set the keys to the following:
provider - DMaps
MinInstances - 0
MaxInstances - 0
Which is what I have found the instance JSON properties on the server get set to. Is there something else to modify in the sddraft xml file to get this working?
```
arcgisscripting.ExecuteError: ERROR 001487: Failed to update the published service with the server-side data location. Please see the server's log for more details.
ERROR 001369: Failed to create the service.
Failed to execute (Publish Service Definition).
Failed.
Failed to execute (UploadServiceDefinition).
Failed to execute (PublishProMapToServer).
```
I see some other messages in the error logs:
```
12:17:08 - Failed to rename cache folder.
12:17:08 - Error executing tool. PublishServiceDefinition Job ID: j16be642f02d74b42b63c03c41765b958 : ERROR 001487: Failed to update the published service with the server-side data location. Please see the server's log for more details. ERROR 001369: Failed to create the service. Failed to execute (Publish Service Definition).
12:17:08 - Failed to create the service.: Invalid at the top level of the document.
12:17:08 - Service rename is complete.
```
I think that at 10.7 is still not possible to publish a service to a shared instance. Once is published, you can change the instance type. There is a new operation in the admin rest api: ChangeProvider, using this operation (to DMaps), and editing the service json to modify mininstances (0), maxinstances (0) and Provider (Dmaps), the service´s instance type is changed.
I couldnt find documentation of this new operation, and how to programatically change this via a script, yet.
Hope this helps.
I manage to add it by editing the sddraft and change the provider to DMaps
Here is an article that might help:
https://www.esri.com/arcgis-blog/products/arcgis-enterprise/administration/move-services-to-shared-i...