1
    credential = DeviceCodeCredential()
    ml_client = MLClient(credential, 
                         auth_subscription_id, 
                         auth_resource_group, 
                         auth_workspace_name
                        )

VERSION="1"
data_asset = ml_client.data.get(name="TEST_MLTABLE", version=VERSION)

import mltable

tbl = mltable.load(f"azureml:/{data_asset.id}")
tbl.show(5)

I have authentication with devicecodecredential in Python SDK2 Azure ML Studio. In many scripts everything its ok - i save a parquet, load, dataset etc. But in this code i have a error

DefaultAzureCredential failed to retrieve a token from the included credentials. Attempted credentials: EnvironmentCredential: EnvironmentCredential authentication unavailable. Environment variables are not fully configured. Visit https://aka.ms/azsdk/python/identity/environmentcredential/troubleshoot to troubleshoot.this issue. ManagedIdentityCredential: No token received. To mitigate this issue, please refer to the troubleshooting guidelines here at https://aka.ms/azsdk/python/identity/defaultazurecredential/troubleshoot

In line

tbl = mltable.load(f"azureml:/{data_asset.id}")

I dont understand why... Where is a token? How i can use token in DeviceCodeCredential?

PS. When i try data.get from dataset with parquet - everything its ok...

VERSION="3"
data_asset2 = ml_client.data.get(name="TEST2", version=VERSION)
df = pd.read_parquet(data_asset2.path)

The same ml_client... The same notebook....

Paweł
  • 61
  • 4

1 Answers1

0

I have reproduced the scenario, with DeviceCodeCredential enter image description here It executed successfully.

Please recheck your permissions, azure.ai.ml package version and check this documentation for properly set-up your credentials.

As alternate way, you can use DefaultAzureCredential as credentials for your ml_client.

Below is a sample code snippet:

import mltable
from azure.ai.ml import MLClient
from azure.identity import DefaultAzureCredential
ml_client = MLClient(
DefaultAzureCredential(), subscription_id, resource_group, workspace)
data_asset = ml_client.data.get(name="sample_data", version=VERSION)
# create a table
tbl = mltable.load(f"azureml:/{data_asset.id}")
# load into pandas
df = tbl.to_pandas_dataframe()
df.head(5)

enter image description here

RishabhM
  • 525
  • 1
  • 5