Hi
Has anyone found a way on how to create an arcgis server connection file (*.ags) with the python environment coming with ArcGIS Pro? I mean with python 3.x and not the old python 2.7 from ArcMap.
There is an function to create a connection file, but this only runs with python 2.7 (old stuff).
https://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/creategisserverconnectionfile.htm
Thanks
Solved! Go to Solution.
agreed. this has been a major bummer for automation.
the following works:
# in the same conda environment where i normally import arcpy:
import arcgisscripting
arcgisscripting._createGISServerConnectionFile("ADMINISTER_GIS_SERVICES", "C:/admin", "new.ags", "https://maxscoolserver.org/raster", "ARCGIS_SERVER", True, "C:/admin", "sitemanager", "password123")
warning: this is a private method so may not be a great idea, but i'm going to do it until something better comes along.
We are also facing a similar issue. The arcpy function to create arcgis server connection file - CreateGISServerConnectionFile is no longer exposed or available with python 3.x? The automated python solution to enable one touch deployment on our CI/CD servers are dependent on creating .ags files on the fly. Any idea if this is exposed with python 3.x
agreed. this has been a major bummer for automation.
the following works:
# in the same conda environment where i normally import arcpy:
import arcgisscripting
arcgisscripting._createGISServerConnectionFile("ADMINISTER_GIS_SERVICES", "C:/admin", "new.ags", "https://maxscoolserver.org/raster", "ARCGIS_SERVER", True, "C:/admin", "sitemanager", "password123")
warning: this is a private method so may not be a great idea, but i'm going to do it until something better comes along.
Great, thanks.
Exactly what I was looking for.
Thank you so much. Exactly what I was looking for @MaxSquires
Hi @MaxSquires i am getting a runtime error when i am using this function in a jupyter notebook. my instance lookes somtehing like this . what could be the issue?
import arcgisscripting
acrcgissripting._createGISServerConnectionFile("PUBLISH_GIS_SERVICES", "/arcigs/home", "test.ags", "https://serverurl", "ARCGIS_SERVER", True, "/arcgis/home", "username", "password","SAVE_USERNAME")
Excellent! I will try this until there is a better alternative.
I think arcpy.management.CreateDatabaseConnection might be what you are looking for?
i don't think so.