I am trying to create an AzureBlobDatastore()
via the azure-sdk-v2. Previously, I successfully managed to perform the same operation via azure-sdk-v1 (from tutorial link in the next paragraph).
I am following this tutorial : https://learn.microsoft.com/en-us/azure/machine-learning/migrate-to-v2-resource-datastore#create-a-datastore-from-an-azure-blob-container-via-account_key in order to set up/create my AzureBlobDatastore()
.
This is the code that I am using (like in the tutorial, only updating the parameters in MLClient.from_config()
(if I don't use the credential parameter I get an error stating that the parameter is empty):
ml_client = MLClient.from_config(credential=DefaultAzureCredential(),
path="./workspace_config_sdk2.json")
store = AzureBlobDatastore(
name="azureml_sdk2_blob",
description="Datastore created with sdkv2",
account_name=storage_account_name,
container_name=container_name,
protocol="wasbs",
credentials={
"account_key": "..my_account_key.."
},
)
ml_client.create_or_update(store)
I get the following error:
AttributeError: 'dict' object has no attribute '_to_datastore_rest_object'
Note that the workspace_config_sdk2.json
config has the following scheme:
{
"subscription_id": "...",
"resource_group": "...",
"workspace_name": "..."
}
How can I solve this error?
EDIT: On investigating the issue, it seems that it falls back to some code in "azure\ai\ml\entities\_datastore\azure_storage.py
"
175 def _to_rest_object(self) -> DatastoreData:
176 blob_ds = RestAzureBlobDatastore(
177 account_name=self.account_name,
178 container_name=self.container_name,
--> 179 credentials=self.credentials._to_datastore_rest_object(),
180 endpoint=self.endpoint,
181 protocol=self.protocol,
182 tags=self.tags,
183 description=self.description,
184 )
185 return DatastoreData(properties=blob_ds)
AttributeError: 'dict' object has no attribute '_to_datastore_rest_object'
To provide an update on this, As mentioned @nthandeMS we have released version 1.4.0 of azure-ai-ml. Using this version the above query can be resolved.
For more information, please refer to this link: https://github.com/Azure/azure-sdk-for-python/issues/28518