How to create an arcgis server connection file with the python 3.x environment (from ArcGIS Pro)

1773
7
Jump to solution
03-04-2021 06:25 AM
Labels (1)
LorenzMeyer1
New Contributor III

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

1 Solution

Accepted Solutions
MaxSquires
Occasional Contributor

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")

 

MaxSquires_1-1618518511995.png

MaxSquires_2-1618518531573.png

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.

View solution in original post

7 Replies
nutscrewbolt
New Contributor II

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

 

0 Kudos
MaxSquires
Occasional Contributor

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")

 

MaxSquires_1-1618518511995.png

MaxSquires_2-1618518531573.png

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.

View solution in original post

LorenzMeyer1
New Contributor III

Great, thanks.

Exactly what I was looking for.

0 Kudos
nutscrewbolt
New Contributor II

Thank you so much. Exactly what I was looking for @MaxSquires 

0 Kudos
RehanChaudhary
New Contributor III

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")

 

0 Kudos
PeterKnoop
Occasional Contributor III

I think arcpy.management.CreateDatabaseConnection might be what you are looking for?

0 Kudos
MaxSquires
Occasional Contributor

i don't think so.