How to fix ML_Client can not connect to the workspace

zmsoft 775 Reputation points
2025-01-16T02:11:09.7233333+00:00

Hi there,

I am trying to connect the ML workspace on my notebook.

Here's my code

# import required libraries
from azure.ai.ml import MLClient
from azure.ai.ml.entities import Environment, BuildContext
from azure.identity import DefaultAzureCredential


# Enter details of your AML workspace
subscription_id = ""
resource_group = ""
workspace = ""

# get a handle to the workspace
ml_client = MLClient(
    DefaultAzureCredential(), subscription_id, resource_group, workspace
)

Then I got the following errors

ClientAuthenticationError: DefaultAzureCredential failed to retrieve a token from the included credentials. Attempted credentials: EnvironmentCredential: EnvironmentCredential authentication unavailable. Environment variables are not fully configured. Visit 

Any suggestion?

Thanks&Regards,

zmsoft

Azure Machine Learning
0 comments No comments

1 answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    1 deleted comment

    Comments have been turned off. Learn more

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.