When I try to access Azure Storage File Shares from Azure Machine Learning Notebook, I get the following error.
1. Error Message
DataAccessError(PermissionDenied(Some(NoIdentityOnCompute)))
2. What I did
I executed the following code from Notebook to get image data stored in the Azure Storage File Shares.
Since the datasource is File Shares, I used "abfss" as the type, and followed the instructions written in the document (https://learn.microsoft.com/en-us/azure/machine-learning/how-to-read-write-data-v2?tabs=python)
from azure.ai.ml import command
from azure.ai.ml import UserIdentityConfiguration
from azure.ai.ml import Input
gpu_compute_target = "gpu-cluster-rainbow"
custom_env_name = "keras-env"
web_path = "abfss://[file_shared_name]@[storage_account_name].dfs.core.windows.net/[file_shared_name]/[path]/"
job_env = ml_client.environments.get(name=custom_env_name, version=str(len(list(ml_client.environments.list(name=custom_env_name)))))
job = command(
inputs=dict(
data_folder=Input(type="uri_folder", path=web_path),
),
compute=gpu_compute_target,
environment=f"{job_env.name}:{job_env.version}",
code="./src/",
command="python keras_image_preprocessing.py --data-folder ${{inputs.data_folder}}",
experiment_name="keras-images-preprocessing-kaggle",
display_name="keras-images-preprocessing",
)
ml_client.jobs.create_or_update(job)
as per now I am allowing public access for the storage.
3. I also tried...
I also tried to make a data store using SDK v2, refering to the following document.
https://learn.microsoft.com/en-us/azure/machine-learning/how-to-datastore?tabs=cli-identity-based-access%2Ccli-adls-identity-based-access%2Csdk-azfiles-sas%2Csdk-adlsgen1-identity-access
But, this time I also stuck because I couldn't import the following package.
from azure.ai.ml.entities._datastore.credentials import SasTokenCredentials
I was assuming this import will succeed because I am using the Python SDK v2, but only the above import is failing.
I will also show the full piece of code (Both Sas Token, Account key is not working)
from azure.ai.ml.entities import AzureFileDatastore
from azure.ai.ml.entities._datastore.credentials import SasTokenCredentials
from azure.ai.ml import MLClient
store = AzureFileDatastore(
name="file-sas-example",
description="Datastore pointing to a file share using sas token.",
account_name="rainbowmlstorage",
file_share_name="xxxx",
# credentials=SasTokenCredentials(
# sas_token="?sv=xxxxxxxxxxxx"
# ),
credentials={
"account_key": "xxxx"
},
)
Would somebody help me?