Azure ML Workspace Reference via MLClient
Short answer
B No
Question
- 
Key Takeaways
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.
Expert Analysis
Why the Answer Is Correct
The suggested answer 'B' is likely incorrect based on current Azure AI ML SDK standards. The azure-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 the get() 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 of WorkspaceOperations.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
This link opens the official vendor documentation in a new tab.
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.
Community Votes
100% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 3 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 3
-
AzureGeek79 👍 2Correct answer is A, see reference below: https://learn.microsoft.com/en-us/python/api/azure-ai-ml/azure.ai.ml.operations.workspaceoperations?view=azure-python#azure-ai-ml-operations-workspaceoperations-get
-
Techlover74 👍 1 Answered BB is the correct answer because the argument is not passed with the key in get method.
-
sl_mslconsulting 👍 1 Answered Byou need to specify subscription id when instantiating the MLClient.
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.