Error while connecting to Azure ML data asset using Pandas SDK V2 code.

Aditi Shah 20 Reputation points
2024-01-31T21:35:46.9166667+00:00

@Alfred Revilla Please help.User's image

Found the config file in: ./.azureml/config.json
Traceback (most recent call last):
  File "/home/trusted-service-user/cluster-env/env/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3433, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "/tmp/ipykernel_8169/2396400857.py", line 6, in <module>
    data_asset = ml_client.data.get("test_medallia", version="1")
  File "/home/trusted-service-user/cluster-env/env/lib/python3.10/site-packages/azure/ai/ml/_telemetry/activity.py", line 275, in wrapper
    return f(*args, **kwargs)
  File "/home/trusted-service-user/cluster-env/env/lib/python3.10/site-packages/azure/ai/ml/operations/_data_operations.py", line 269, in get
    data_version_resource = self._get(name, version)
  File "/home/trusted-service-user/cluster-env/env/lib/python3.10/site-packages/azure/ai/ml/operations/_data_operations.py", line 198, in _get
    else self._operation.get(
  File "/home/trusted-service-user/cluster-env/env/lib/python3.10/site-packages/azure/core/tracing/decorator.py", line 78, in wrapper_use_tracer
    return func(*args, **kwargs)
  File "/home/trusted-service-user/cluster-env/env/lib/python3.10/site-packages/azure/ai/ml/_restclient/v2023_04_01_preview/operations/_data_versions_operations.py", line 479, in get
    pipeline_response = self._client._pipeline.run(  # pylint: disable=protected-access
  File "/home/trusted-service-user/cluster-env/env/lib/python3.10/site-packages/azure/core/pipeline/_base.py", line 211, in run
    # This code is fine as long as HTTPRequestType is actually
  File "/home/trusted-service-user/cluster-env/env/lib/python3.10/site-packages/azure/core/pipeline/_base.py", line 71, in send
  File "/home/trusted-service-user/cluster-env/env/lib/python3.10/site-packages/azure/core/pipeline/_base.py", line 71, in send
  File "/home/trusted-service-user/cluster-env/env/lib/python3.10/site-packages/azure/core/pipeline/_base.py", line 71, in send
  [Previous line repeated 2 more times]
  File "/home/trusted-service-user/cluster-env/env/lib/python3.10/site-packages/azure/mgmt/core/policies/_base.py", line 47, in send
    response = self.next.send(request)
  File "/home/trusted-service-user/cluster-env/env/lib/python3.10/site-packages/azure/core/pipeline/policies/_redirect.py", line 153, in send
    response.http_request.url = "{}://{}/{}".format(
  File "/home/trusted-service-user/cluster-env/env/lib/python3.10/site-packages/azure/core/pipeline/policies/_retry.py", line 445, in send
    response: PipelineResponse[HTTPRequestType, HTTPResponseType],
  File "/home/trusted-service-user/cluster-env/env/lib/python3.10/site-packages/azure/core/pipeline/policies/_authentication.py", line 111, in send
    if self._enable_cae:
  File "/home/trusted-service-user/cluster-env/env/lib/python3.10/site-packages/azure/core/pipeline/policies/_authentication.py", line 88, in on_request
  File "/home/trusted-service-user/cluster-env/env/lib/python3.10/site-packages/azure/identity/_credentials/default.py", line 144, in get_token
    return super(DefaultAzureCredential, self).get_token(*scopes, **kwargs)
  File "/home/trusted-service-user/cluster-env/env/lib/python3.10/site-packages/azure/identity/_credentials/chained.py", line 90, in get_token
    raise ClientAuthenticationError(message=message)
azure.core.exceptions.ClientAuthenticationError: DefaultAzureCredential failed to retrieve a token from the included credentials.
Attempted credentials:
	EnvironmentCredential: EnvironmentCredential authentication unavailable. Environment variables are not fully configured.
	ManagedIdentityCredential: ManagedIdentityCredential authentication unavailable, no managed identity endpoint found.
	SharedTokenCacheCredential: SharedTokenCacheCredential authentication unavailable. No accounts were found in the cache.
	VisualStudioCodeCredential: Failed to get Azure user details from Visual Studio Code.
	AzureCliCredential: Azure CLI not found on path
Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
2,435 questions
{count} votes

Accepted answer
  1. Maui Rivera 235 Reputation points Microsoft Employee
    2024-02-14T05:07:37.5333333+00:00

    It looks like you are getting a client authentication error with the attempted credential.

    azure.core.exceptions.ClientAuthenticationError: DefaultAzureCredential failed to retrieve a token from the included credentials. Attempted credentials: EnvironmentCredential: EnvironmentCredential authentication unavailable. Environment variables are not fully configured. ManagedIdentityCredential: ManagedIdentityCredential authentication unavailable, no managed identity endpoint found. SharedTokenCacheCredential: SharedTokenCacheCredential authentication unavailable. No accounts were found in the cache. VisualStudioCodeCredential: Failed to get Azure user details from Visual Studio Code. AzureCliCredential: Azure CLI not found on path

    If you're trying to build the MLClient object using a DefaultAzureCredential() and encounter an error, it may be because you're using a ServerlessSparkCompute or running it in an environment where the necessary environment variables are not present. This happens because DefaultAzureCredential() relies on EnvironmentCredential(), which requires specific environment variables to be set and configured correctly. If these variables are not set, this error may occur.

    Please see the following for details regarding credentials. Source: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/identity/azure-identity/TROUBLESHOOTING.md#troubleshoot-environmentcredential-authentication-issues

    You may configure these environment variables before using the DefaultAzureCredential(). For example,

    import os
    os.environ["AZURE_TENANT_ID"] = "YOUR_AZURE_TENANT_ID"
    
    0 comments No comments

0 additional answers

Sort by: Most helpful