Creating a handle not connect to the workspace

Ammar Huss 20 Reputation points
2023-05-18T21:27:54.0066667+00:00

I am using below code to connect to my workspace but it failed -

Any idea what I missed?

from azure.ai.ml import MLClient
from azure.identity import DefaultAzureCredential

# authenticate
credential = DefaultAzureCredential()
# # Get a handle to the workspace
ml_client = MLClient(
    credential=credential,
    subscription_id="<SUBSCRIPTION_ID>",
    resource_group_name="<RESOURCE_GROUP>",
    workspace_name="<AML_WORKSPACE_NAME>",
)

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
2,714 questions
0 comments No comments
{count} votes

Accepted answer
  1. YutongTie-MSFT 48,501 Reputation points
    2023-05-19T01:47:42.6+00:00

    Hello @Ammar Huss

    Thanks for reaching out to us. Have you tried to make a call? As the document describes -

    Creating MLClient will not connect to the workspace. The client initialization is lazy, it will wait for the first time it needs to make a call (this will happen in the next code cell).

    Please call it at least once to make the connection.

    https://learn.microsoft.com/en-us/azure/machine-learning/tutorial-explore-data?view=azureml-api-2#create-handle-to-workspace

    I hope this helps. Please let me know if that happened after you make a call but still not succeed.

    Thanks,

    Yutong

    -Please kindly accept the answer and vote 'Yes' if you feel helpful to support the community, thanks a lot.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful