Azure ML Workspace Reference via MLClient
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? -
- 
Community Votes
100% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
The core concept is using azure.ai.ml.MLClient to access workspaces; the trap involves confusing older SDK syntax with the newer azure-ai-ml package requirements or misinterpreting parameter passing in the get() method.
This question tests the correct instantiation of the Azure Machine Learning Python SDK (azure-ai-ml) to retrieve a workspace reference. While community votes suggest 'No', official documentation indicates that the provided code pattern using MLClient is the standard method, making 'Yes' the technically accurate answer for modern SDK versions.
Community Discussion (3 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
The suggested answer 'B' is likely incorrect based on current Azure AI ML SDK standards. Theazure-ai-ml library uses the MLClient class to interact with resources. Instantiating MLClient(credential, subscription_id, resource_group_name, workspace_name) provides a context manager or client object. Calling .workspaces.get() on this instance is the valid way to retrieve the workspace reference. If the code snippet shown in the images follows this pattern, the answer should be 'Yes'.Why the Other Options Are Wrong
Choosing 'No' implies the code fails to meet the goal. This might stem from confusion regarding theget() method's parameters. In newer SDKs, workspace_name is often required in the constructor, not necessarily in the get() call if the workspace name is already bound to the client. If the code passes the workspace name only to get() but not to the constructor, it would fail, but the standard pattern binds it at construction.Community Comment Notes
Comment [1] correctly cites Microsoft Learn documentation supporting the use ofWorkspaceOperations.get, implying the code is valid. Comment [2] argues for 'No' by stating the subscription ID must be specified during instantiation, which is true for MLClient creation, but if the code does that, the solution works. The high vote count for 'No' appears to be a consensus error driven by misunderstanding the specific SDK version syntax. Official Reference
Exam Strategy
Always check the specific SDK package name (azure-ai-ml vs azureml-core). For DP-100, focus on the azure-ai-ml v2 SDK where MLClient is instantiated with all necessary identifiers (subscription, resource group, workspace) upfront, allowing subsequent calls like .workspaces.get() to be simple.