Hi
I'm currently looking for "the correct way" on how to publish services to portal or to a portal federated servers (like an imageserver).
For example I have a mosaic dataset and I would like to create a service with it on my imageserver, which is federated with my portal. In ArcGIS Pro there I select my mosaic dataset and then I click "Share as weblayer". The connection is then read from the active portal (manage portals in ArcGIS Pro). I can then select my image server to host the service.
What is the "correct" way to automate this process with python (arcpy or python api for arcgis)? What I have so far:
- Create an *.ags connection file to the arcgis server (imageserver) - This I had to do manually. There seems no function to create a connection file with python 3.x (ArcGIS Pro)
- arcpy.CreateImageSDDraft --> Create service draft file with connection file created above
- arcpy.StageService --> Create service definition file from sddraft
- arcpy.UploadServiceDefinition_server --> Upload the service to the imageserver. An item in portal is automatically created, but I don't get the itemId in return of this function. I have to search the content of the portal to find the newly created item by title. Is there a better way to upload it to portal?
- Use the GIS object from the python api for arcgis an establish a portal connection
- Search portal content for newly created item
- Update the found item with tags, description and so on..
- Share the item to public or to the organisation
The whole process is mix between arcpy and python api for arcgis and I don't know if this is the way to go? And not all necessary function are available (CreateServer Connection File) in python 3.x .
When to use arcpy and when to use the new python api for arcgis?
Any ideas or tipps? Searching the examples didn't really help.