ArcPy and SSL Certificates

1978
1
03-19-2018 02:01 PM
XiaoWang4
New Contributor

Hello,

I am trying to use arcPy (Python 2.7.13) to register a folder in ArcGIS Enterprise Server 10.5.1 on Windows 2012r2. I have verified my connection file works as well. My python script is based on the example here, which is also below

import arcpy

conn = "C:/config/myConnection.ags"
path = "C:/Data"

arcpy.AddDataStoreItem(conn, "FOLDER", "MYDIR", path, path)

When executing the script I am prompted to accept a cert like the image belowArcPy Certificate Prompt

My question is there any way to configure ArcPy with a certificate, so that I do not receive this prompt? I've tried to import the ssl module and set both the cafile and SSL_CERT_FILE environment variables. Also, it seems that clicking either "Yes" or "No" in the Security Alert prompt both cause the script to work.

Any help is greatly appreciated.

Thanks!

Tags (1)
0 Kudos
1 Reply
KaiSteinicke1
Esri Contributor

The problem is related to the servers certificate. As the message tells, you are trying to connect to the server using a name that does not match the servers certificate.   

Try changing it to use the FQDN (Full Qualified Domain Name) of the server:

   https://hostname.domain.name/webadaptor or

   https://hostname.domain.name:6443/arcgis

Or click on "View Certificate" to find the "Issued To" field and use that.

Additional Info:

Suppress warnings from self-signed certificates—ArcGIS Server Administration (Windows) | ArcGIS Ente... 

0 Kudos