Unable to operate with datastores from azureml workspace

Muhammad Hassan 0 Reputation points
2023-10-15T13:56:18.1333333+00:00

I am unable to access datastores using azureml workspace. I have set environment variables for authentication.

print(os.environ['AZURE_CLIENT_ID'])
print(os.environ['AZURE_TENANT_ID'])
print(os.environ['AZURE_CLIENT_SECRET'])
credential = DefaultAzureCredential()
workspace = Workspace.from_config()
datastore = workspace.get_default_datastore()

But the last line where I am fetching default datastore, I always get the following error:

requests.exceptions.SSLError: HTTPSConnectionPool(host='southeastasia.api.azureml.ms', port=443): Max retries exceeded with url: /discovery (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1002)')))

For my service principal I have assigned "AzureML Data Scientist" role. Any help is highly appreciated, as I have been struggling with this for so long.

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
3,231 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ramr-msft 17,821 Reputation points
    2023-10-16T02:47:36.0766667+00:00

    @Muhammad Hassan Thanks for the question, The error you’re encountering, SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1002)')), typically occurs when the SSL certificate verification fails. This can happen if the certificate is self-signed, not trusted by a Certificate Authority, or if there’s an issue with the client’s certificate chain.

    Here are a few potential solutions:

    1. Proxy Issue: If you’re behind a proxy, it might be causing this issue. You might need to configure your environment to properly use the proxy.
    2. Certificate Issue: The error message suggests that there might be a self-signed certificate in the certificate chain. You might need to add this self-signed certificate to your trusted certificates.
    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.