
Answer-first summary for fast verification
Answer: Yes
The solution uses `Workspace.get()` with the specific parameters `name='ml-project'`, `subscription_id='sub-id-1'`, and `resource_group='rg-name-1'`. This method directly retrieves the workspace using explicit identifiers, which is the correct approach when you know the exact subscription, resource group, and workspace name. It avoids dependency on a config file and ensures the correct workspace is referenced, especially since there are multiple workspaces named 'ml-project' across different subscriptions. The community discussion shows confusion with `Workspace.from_config()`, but the provided code uses `Workspace.get()`, which is appropriate here. The answer is 'Yes' because the code will successfully obtain a reference to the specified workspace.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
You have the following Azure subscriptions and Azure Machine Learning service workspaces:
sub-id-1, Workspace Name: ml-projectsub-id-2, Workspace Name: ml-projectYou need to obtain a reference to the ml-project workspace in the sub-id-1 subscription.
Solution: Run the following Python code:
from azureml.core import Workspace
ws = Workspace.get(name='ml-project',
subscription_id='sub-id-1',
resource_group='rg-name-1')
from azureml.core import Workspace
ws = Workspace.get(name='ml-project',
subscription_id='sub-id-1',
resource_group='rg-name-1')
Does the solution meet the goal?

A
Yes
B
No