Azure ML Workspace Authentication with MLClient.from_config

Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution. After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen. You have the following Azure subscriptions and Azure Machine Learning service workspaces: You need to obtain a reference to the ml-project workspace. Solution: Run the following Python code: Does the solution meet the goal? - image - image

  1. Yes
  2. No Source Reference Answer

Community Votes

B
57%
A
43%

57% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

The exam tests knowledge of the azure-ai-ml library's initialization methods, specifically trapping candidates who assume default authentication works without explicit configuration or credentials in code.

This question tests the correct syntax for authenticating Azure Machine Learning workspaces using the Python SDK. The community consensus indicates that the provided solution fails because it omits a required credential parameter.

Many candidates select 'Yes' (Option A) assuming that if they are logged into Azure CLI, the SDK will automatically pick up their identity without needing to pass a credential object explicitly in this specific method call context.

Community Discussion (6 comments)

Murzfam 👍 1 Selected: B
The questions is reference to ml-project workspace. The solutions is only about auth, so the answer is B.
jl420 👍 2 Selected: A
MLClient.from_config() can be used without explicitly providing credentials, as long as your authentication requirements are met in one of the following ways: Default Authentication with Azure CLI Login: If you’ve already authenticated using the Azure CLI (e.g., az login), MLClient.from_config() will use your active Azure CLI session for authentication. This is often convenient for development environments and local testing. Managed Identity (for Azure Compute Resources): If you’re running your code on an Azure resource with a managed identity (like an Azure Virtual Machine, Azure Kubernetes Service, or Azure Machine Learning Compute Instance), the SDK can authenticate using the managed identity associated with that resource. No additional credentials are needed, as long as the managed identity has access to the Azure ML workspace. Environment-Based Authentication: If environment variables for Azure credentials are set (e.g., AZURE_CLIENT_ID, AZURE_TENANT_ID, and AZURE_CLIENT_SECRET for a service principal), MLClient.from_config() will pick up these credentials automatically.
evangelist 👍 1 Selected: A
Answer should be Yes, it appeared previously in the exam questions
sl_mslconsulting 👍 1 Selected: B
credential is a required parameter in the from_config method . Link: https://learn.microsoft.com/en-us/python/api/azure-ai-ml/azure.ai.ml.mlclient?view=azure-python#azure-ai-ml-mlclient-from-config
Plb2 👍 2 Selected: B
credential-parameter is required
zishankamal 👍 2
Unsure. The credential parameter is not specified which is mandatory. Otherwise class and method is correct.

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

The suggested answer is B (No) because the MLClient.from_config() method in the modern azure-ai-ml package typically requires an identity or credential argument depending on the specific version and environment setup, especially when not relying on implicit environment variables. While from_config() reads configuration from a file, secure practices and many exam scenarios require explicit credential handling for production-grade references.

Why the Other Options Are Wrong

Selecting Option A implies the code is sufficient. This is incorrect because the code snippet shown (implied by the context of comments) likely lacks the necessary credential instantiation or passes an incomplete object. In strict certification contexts, omitting explicit security parameters is considered a failure to meet best practices for workspace access.

Community Comment Notes

Comment [1] argues for 'Yes' based on Azure CLI default auth, which is valid in local dev but often considered insufficient in exam logic requiring explicit code correctness. Comments [2], [3], and [6] correctly identify that the credential parameter is mandatory or missing, leading to the correct conclusion that the solution does not meet the goal of obtaining a secure reference.

Official Reference

Exam Strategy

Always verify if the SDK method requires explicit credential objects versus relying on environment defaults. In DP-100, prefer solutions that explicitly handle authentication rather than those assuming implicit context, unless the scenario specifically highlights a local development environment.

Related Analysis

← Back to DP-100 Study Guide