I was trying to create a custom Print Service to use with the ArcGIS API (Print task). I made my own python toolbox using ConvertWebMapToMapDocument. I added my arcgis connection file (.ags) to the "extra_conversion_options" parameter of the tool.
The ags file is the exact same one that I used to create a Print service using the built-in toolbox from ESRI, and this print service is working well.
I stored it under one of my registered folder on the server.
The toolbox compiles and works fine locally (it does not ask for credentials). However whatever I do, when it is published as a service, I always get an error :
"RuntimeError: Layer "....": Unable to connect to map server at "
Even weirder, some of the feature services I add to the map, seem to print ok while most don't. They are all secured the same way, and stored at the same place.