Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AzureML SDK - No module named 'azure.ai.ml.entities._datastore.credentials' #37704

Open
edgBR opened this issue Oct 3, 2024 · 5 comments
Open
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Machine Learning needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@edgBR
Copy link

edgBR commented Oct 3, 2024

  • Package Name: azure-ai-ml
  • Package Version: 1.20.0
  • Operating System: Linux 24.09.23 - Ubuntu 20.04.6 LTS (AzureML compute Instance)
  • Python Version: 3.10.4

Describe the bug
It seems that documentation is incorrect regarding AzureML Datastores as the SDK component doesnt exist

To Reproduce
Steps to reproduce the behavior:

  1. Follow this link: https://learn.microsoft.com/en-us/azure/machine-learning/how-to-datastore?view=azureml-api-2&tabs=sdk-account-key%2Csdk-adls-sp%2Csdk-azfiles-accountkey%2Csdk-adlsgen1-identity-access%2Csdk-onelake-sp#create-an-azure-data-lake-storage-gen2-datastore

Run the following:

from azure.ai.ml.entities import AzureDataLakeGen2Datastore
from azure.ai.ml.entities._datastore.credentials import ServicePrincipalCredentials

from azure.ai.ml import MLClient

ml_client = MLClient.from_config()

store = AzureDataLakeGen2Datastore(
    name="adls_gen2_example",
    description="Datastore pointing to an Azure Data Lake Storage Gen2.",
    account_name="mytestdatalakegen2",
    filesystem="my-gen2-container",
     credentials=ServicePrincipalCredentials(
        tenant_id= "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
        client_id= "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
        client_secret= "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    ),
)

ml_client.create_or_update(store)

It will break in:

image

Expected behavior
I expect the documentation to be correct.

@edgBR edgBR changed the title No module named 'azure.ai.ml.entities._datastore.credentials' AzureML SDK - No module named 'azure.ai.ml.entities._datastore.credentials' Oct 3, 2024
@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Machine Learning needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. labels Oct 3, 2024
Copy link

github-actions bot commented Oct 3, 2024

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Azure/azure-ml-sdk @azureml-github.

@edgBR
Copy link
Author

edgBR commented Oct 4, 2024

Hi, any feedback on this?

@LukePWilkins
Copy link

Hello.
Experiencing the same, while running through the SDKv2 examples - https://github.com/Azure/azureml-examples/blob/main/sdk/python/resources/datastores/datastore.ipynb

{
	"name": "ModuleNotFoundError",
	"message": "No module named 'azure.ai.ml.entities._datastore.credentials'",
	"stack": "---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[7], line 11
      4 from azure.ai.ml import command, Input
      5 from azure.ai.ml.entities import (
      6     AzureBlobDatastore,
      7     AzureFileDatastore,
      8     AzureDataLakeGen1Datastore,
      9     AzureDataLakeGen2Datastore,
     10 )
---> 11 from azure.ai.ml.entities._datastore.credentials import (
     12     AccountKeyCredentials,
     13     SasTokenCredentials,
     14     ServicePrincipalCredentials,
     15 )
     16 from azure.ai.ml.entities import Environment

ModuleNotFoundError: No module named 'azure.ai.ml.entities._datastore.credentials'"
}

@LukePWilkins
Copy link

Referencing this link - https://learn.microsoft.com/en-us/azure/machine-learning/how-to-datastore?view=azureml-api-2&tabs=sdk-identity-based-access%2Csdk-adls-identity-access%2Csdk-azfiles-accountkey%2Csdk-adlsgen1-identity-access%2Csdk-onelake-identity-access

I rewrote to

# from azure.ai.ml.entities._datastore.credentials import (
#     AccountKeyCredentials,
#     SasTokenCredentials,
#     ServicePrincipalCredentials,
# )

# added - 16/10/2024 - Luke Wilkins
from azure.ai.ml.entities import (
    AccountKeyConfiguration,
    SasTokenConfiguration,
    ServicePrincipalConfiguration
)
blob_datastore1 = AzureBlobDatastore(
    name="lwrwmachinemachinestore",
    description="Datastore for lovely MachineMachine.",
    account_name="lwrwmachinemachinestore",
    container_name="data-container",
    credentials=AccountKeyConfiguration(
        account_key="xxxxxxxxxxx"
    )
    # credentials=AccountKeyCredentials(
    #     account_key="XXXxxxXXXxXXXXxxXXXXXxXXXXXxXxxXxXXXxXXXxXXxxxXXxxXXXxXxXXXxxXxxXXXXxxxxxXXxxxxxxXXXxXXX"
    #),
)
ml_client.create_or_update(blob_datastore1)

Confirm dataStore is created via sighting in the portal.

achauhan-scc added a commit to achauhan-scc/azure-ai-docs that referenced this issue Feb 3, 2025
@achauhan-scc
Copy link
Member

Sample PR fix - Azure/azureml-examples#3504
documentation PR fix - MicrosoftDocs/azure-ai-docs#205

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Machine Learning needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

4 participants