get_workspace

health_azure.get_workspace(aml_workspace=None, workspace_config_path=None)[source]

Retrieve an Azure ML Workspace by going through the following steps:

  1. If the function has been called from inside a run in AzureML, it returns the current AzureML workspace.

  2. If a Workspace object has been provided in the aml_workspace argument, return that.

  3. If a path to a Workspace config file has been provided, load the workspace according to that config file.

  4. If a Workspace config file is present in the current working directory or one of its parents, load the

workspace according to that config file.

  1. If 3 environment variables are found, use them to identify the workspace (HIML_RESOURCE_GROUP,

HIML_SUBSCRIPTION_ID, HIML_WORKSPACE_NAME)

If none of the above succeeds, an exception is raised.

Parameters
  • aml_workspace (Optional[Workspace]) – If provided this is returned as the AzureML Workspace.

  • workspace_config_path (Optional[Path]) – If not provided with an AzureML Workspace, then load one given the information in this config

Return type

Workspace

Returns

An AzureML workspace.

Raises
  • ValueError – If none of the available options for accessing the workspace succeeds.

  • FileNotFoundError – If the workspace config file is given in workspace_config_path, but is not present.