I believe there is a functionality gap in ArcGIS API for Python & ArcPy in terms of overwriting services via Python while retaining existing service properties.
Manually, one is able to overwrite an ArcMap runtime service with a ArcGIS pro map via Pro GUI and retain all service properties however the same workflow is not easily possible via code.
I am writing the suggestion with a goal of improving scripting ease of use for publishers and administrators.
1. Accessing a service's existing json via the rest api and changing its properties does not appear to be a safe or elegant method when changing from ArcMap to Pro runtime. Also it requires rest admin api access to be provided. A higher level esri api option is needed.
2. Bulk runtime update using esri runtime migration tools is also not a viable option as many map services need adjustments to symbology and other misc issues.
Please note that if you use the MapServiceDraft class to overwrite the service using snippet below, all the service's existing properties will be overwritten by default values
sddraft.targetServer = target_server_connection sddraft.overwriteExistingService = True
https://pro.arcgis.com/en/pro-app/latest/arcpy/sharing/mapservicedraft-class.htm - Review full snippet here
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.