Authentication failed when accessing dataset in compute instance using its MSI via AzureML SDK v2
![](https://techprofile.blob.core.windows.net/images/V__cEKU3BECjeOIWYXr7tA.png?8D9261)
The dataset can be previewed in AML workspace when the associated datastore is created using identity-based auth with workspace managed identity. I have the same user managed identity assigned to workspace and compute instance. But it only failed in compute instance while using below code snippet to access the dataset.
# Set your subscription, resource group and workspace name:
subscription_id = "xxx"
resource_group = "xxx"
workspace = "xxx"
# connect to the AzureML workspace
ml_client = MLClient(
DefaultAzureCredential(), subscription_id, resource_group, workspace
)
filedataset_asset = ml_client.data.get(name="xxx", version="1")
tbl = mltable.load(f'azureml:/{filedataset_asset.id}')
df = tbl.to_pandas_dataframe()
df