I have a bunch of referenced map services published to our federated server in our DEV environment, and the data is managed by our Enterprise Geodatabase (SQL Server) in our DEV environment.
I want to find a way to automate the service publishing process so that the same sort of data can be efficiently published to our TEST and PROD environment without much manual involvement, because only the EGDB and Server URL changed. In addition, I would like to keep their portal "item_id" same as in DEV, so that I can easily manage item settings across deployments.
I have tried to upload Service Definition file to the portal and publish the service using ArcGIS Python API "item.publish( item_id = "****")", but the error saying "Unable to publish item. This service definition file was created for an ArcGIS Server site and must be uploaded directly to an ArcGIS Server site through ArcGIS Server Manager or ArcMap." I also tried to upload directly to Server Manager but then I cannot control the Item ID.
Do anyone have idea how to automate the publishing process as I described here?