Azure / Azure/azure-sdk-for-python

mltable ignoring ml_client credentials

Open
#41,792 0 comments 0 reactions 1 assignee Claimed by @vivram View on GitHub
Client customer-reported dataprep Machine Learning ML-Assets needs-team-attention question Service Attention
Dominant language
Python
Stars
5.6k
Forks
3.4k
Avg merge
1d 21h
Merged PRs (30d)
193

Description

- mltable
- 1.6.1
- Fabric notebook
- 3.11

**Describe the bug**
mltable doesnt honour the ml_client credentials passed through, per https://learn.microsoft.com/en-us/python/api/mltable/mltable?view=azure-ml-py#mltable-load.
Whilst azure.ai.ml (workspace, datastores) successfully use the credentials (via devicecodeflow), mltable looks for creds, ignoring the ml_client passed through, and fails.

Code:
tbl = mltable.load(f"azureml:/{data_asset.id}", ml_client=ml_client)
Error:
ClientAuthenticationError: 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: ManagedIdentityCredential authentication unavailable, no response from the IMDS endpoint.
SharedTokenCacheCredential: SharedTokenCacheCredential authentication unavailable. No accounts were found in the cache.
AzureCliCredential: Azure CLI not found on path
AzurePowerShellCredential: PowerShell is not installed
AzureDeveloperCliCredential: Azure Developer CLI could not be found. Please visit https://aka.ms/azure-dev for installation instructions and then,once installed, authenticate to your Azure account using 'azd auth login'.
To mitigate this issue, please refer to the troubleshooting guidelines here at https://aka.ms/azsdk/python/identity/defaultazurecredential/troubleshoot.

Using devicecodeflow to support interactive data exploration from Fabric Notebooks.

**To Reproduce**
Steps to reproduce the behavior:
1. if credential is None:
credential = DeviceCodeCredential() #InteractiveBrowserCredential()

SUBSCRIPTION="3bb9fda7-7f70-47bb-b76e-4f4b934a93c3"
RESOURCE_GROUP="ai_neu_dev_rg"
WS_NAME="ai_neu_dev_aml"
# Get a handle to the workspace
ml_client = MLClient(
credential=credential,
subscription_id=SUBSCRIPTION,
resource_group_name=RESOURCE_GROUP,
workspace_name=WS_NAME,
)
ws = ml_client.workspaces.get(WS_NAME)
print(ws.location,":", ws.resource_group)
2. import mltable

datastore = ml_client.datastores.get("onelake_supply")
data_asset = ml_client.data.get("DeltaReader3", version="1")

# error here
tbl = mltable.load(f"azureml:/{data_asset.id}", ml_client=ml_client)

**Expected behavior**
To use creds and return delta lake data.

**Screenshots**
N/A

**Additional context**
N/A

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.