Creating a handle not connect to the workspace

Ammar Huss 20 Reputation points

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

Any idea what I missed?

from import MLClient
from azure.identity import DefaultAzureCredential

# authenticate
credential = DefaultAzureCredential()
# # Get a handle to the workspace
ml_client = MLClient(

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

    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.

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



    -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