Azure / azureml-examples

Official community-driven Azure Machine Learning examples, tested with GitHub Actions.
https://docs.microsoft.com/azure/machine-learning
MIT License
1.71k stars 1.39k forks source link

Datastore Registering for ADLSGEN2 is throwing error #1624

Open GautamKumarSkyPointCloud opened 2 years ago

GautamKumarSkyPointCloud commented 2 years ago

Which example? Describe the issue

Code Snippet: from azure.ai.ml.entities import ( AzureDataLakeGen2Datastore ) adlsg2_datastore = AzureDataLakeGen2Datastore( name="adls-gen2-example", description="Datastore pointing to an Azure Data Lake Storage Gen2.", account_name="mytestdatalakegen2", filesystem="my-gen2-container", credentials={ "tenant_id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "client_id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "client_secret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", }, ) ml_client.create_or_update(adlsg2_datastore)

Error: AttributeError: 'dict' object has no attribute '_to_rest_object'

LeonardoSanBenitez commented 1 year ago

same problem here, with the AzureBlobDatastore example

valeriepham04 commented 1 year ago

Which example? Describe the issue

Code Snippet: from azure.ai.ml.entities import ( AzureDataLakeGen2Datastore ) adlsg2_datastore = AzureDataLakeGen2Datastore( name="adls-gen2-example", description="Datastore pointing to an Azure Data Lake Storage Gen2.", account_name="mytestdatalakegen2", filesystem="my-gen2-container", credentials={ "tenant_id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "client_id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "client_secret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", }, ) ml_client.create_or_update(adlsg2_datastore)

Error: AttributeError: 'dict' object has no attribute '_to_rest_object'

Thank you for your feedback. The credentials field is not a raw dictionary, it is an object

from azure.ai.ml.entities._datastore.credentials import ServicePrincipalCredentials         
 credentials=ServicePrincipalCredentials(
                        tenant_id="00000000-0000-0000-0000-000000000000",
                        client_id="00000000-0000-0000-0000-000000000000",
                        client_secret="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
                    )

All the examples related to DS create for SDK have been updated in the online doc Use datastores - Azure Machine Learning | Microsoft Learn

LeonardoSanBenitez commented 1 year ago

It worked for me, thank you