I'm trying to utilize the code in the link below to do batch geocoding.
I cant get it to work as it says it cannot find the World.GeocodeServer. Looking in ArcCatalog I can see the ags file, however it will not connect using my Enterprise login. It does connect if I input my public login, however if what I see in ArcMap is correct, I cannot access the Geocode Service without and Enterprise login. When I use my public login the ags file gets created, connects, and then the arcpy.geocoding.GeocodeAddresses function fails. I know I have all the fields correct. I think it's something to do with the fact that I need to login using my Enterprise credentials, however it won't accept them. This could be because I need to provide a different url for the login, but I'm not sure where to do that either. Anyone done this before?
Currently, I don't think it's possible to authenticate using an ArcGIS Online Enterprise Login. If you're an Administrator in your ArcGIS Online organization you can create a built-in user account by going to My Organization > Invite Members. You will be able to use this account to connect to the World Geocoding service.
If you were going to sign into your Enterprise organization's portal in ArcMap you would use the following URL,
https://gisserver.domain.com/portal. More info about portal connections in ArcMap can be found at Manage ArcMap portal connections—Help | ArcGIS Desktop .Then in ArcMap you would be able to sign in with the Enterprise credentials and the World Geocoding Service will be available in the Geocoding toolbar. If you were going to make an ArcGIS Server connection (.ags file) you would use the following URL and include the Enterprise credentials, https://gisserver.domain.com/server .
To add on to my previous response and relating it to the Python code and your Enterprise portal you would make the following changes using your federated server for server_url.
#Create the ArcGIS Server connection file
server_url = "https://gisserver.domain.com/server"
conn_file_name = "arcgis_online_batch_geocoding.ags"
conn_file = os.path.join(cwd, conn_file_name)
username = "<your username>"
password = "<your password>"
arcpy.mapping.CreateGISServerConnectionFile("USE_GIS_SERVICES", cwd, conn_file_name, server_url,
"ARCGIS_SERVER", username=username, password=password)