We are trying to automatically publish datasets into our image server.

We have an environment with a Portal enterprise server, an image server, a raster server and a machine running ArcGIS Pro. I have tried this running on both the image server and the ArcGIS Pro machine.

We are following this documentation example, slightly modified so it only takes a single file rather than all the files in a directory, and gets the parameters from other places.

It runs through with out any problems to the arcpy.UploadServiceDefinition_server call. At which point it fails with the dreaded ERROR 999999

If I try and upload the service definition 'manually' from ArcGIS Pro it works OK. I am using the same .ags file in both cases.

My best guess is that my script is not logged into the portal correctly. I've attempted to use arcpy.SignInToPortal but it seems to have made no difference to the error I am getting.

Does this process only work if run inside of ArcGIS Pro and not the Esri Python environment?

Is there a step that I'm missing when running outside of ArcGIS Pro?

1 Answer 1


Eventually figured out the answer to this.

The product needs to be set to uploaded to the server then the service name had '.' and '-' characters in it. These cause an error in ArcGIS Pro but not with the Python API, until it ends up publishing to the server and then it fails somewhere deep in the guts of ArcGIS Server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.