How to use workspace diagnostics

APPLIES TO: Python SDK azureml v1

Azure Machine Learning provides a diagnostic API that can be used to identify problems with your workspace. Errors returned in the diagnostics report include information on how to resolve the problem.

You can use the workspace diagnostics from the Azure Machine Learning studio or Python SDK.


Before following the steps in this article, make sure you have the following prerequisites:

  • An Azure Machine Learning workspace. If you don't have one, use the steps in the Quickstart: Create workspace resources article to create one.

  • To install the Python SDK v2, use the following command:

    pip install azure-ai-ml azure-identity

    To update an existing installation of the SDK to the latest version, use the following command:

    pip install --upgrade azure-ai-ml azure-identity

    For more information, see Install the Python SDK v2 for Azure Machine Learning.

Diagnostics from studio

From Azure Machine Learning studio or the Python SDK, you can run diagnostics on your workspace to check your setup. To run diagnostics, select the '?' icon from the upper right corner of the page. Then select Run workspace diagnostics.

Screenshot of the workspace diagnostics button

After diagnostics run, a list of any detected problems is returned. This list includes links to possible solutions.

Diagnostics from Python

The following snippet demonstrates how to use workspace diagnostics from Python

APPLIES TO: Python SDK azure-ai-ml v2 (current)

from import MLClient
from import Workspace
from azure.identity import DefaultAzureCredential

subscription_id = '<your-subscription-id>'
resource_group = '<your-resource-group-name>'
workspace = '<your-workspace-name>'

ml_client = MLClient(DefaultAzureCredential(), subscription_id, resource_group)
resp = ml_client.workspaces.begin_diagnose(workspace)

APPLIES TO: Python SDK azureml v1

from azureml.core import Workspace

ws = Workspace.from_config()

diag_param = {
      "value": {

resp = ws.diagnose_workspace(diag_param)

The response is a JSON document that contains information on any problems detected with the workspace. The following JSON is an example response:

    "value": {
        "user_defined_route_results": [],
        "network_security_rule_results": [],
        "resource_lock_results": [],
        "dns_resolution_results": [{
            "code": "CustomDnsInUse",
            "level": "Warning",
            "message": "It is detected VNet '/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Network/virtualNetworks/<virtual-network-name>' of private endpoint '/subscriptions/<subscription-id>/resourceGroups/larrygroup0916/providers/Microsoft.Network/privateEndpoints/<workspace-private-endpoint>' is not using Azure default DNS. You need to configure your DNS server and check to make sure the custom DNS is set up correctly."
        "storage_account_results": [],
        "key_vault_results": [],
        "container_registry_results": [],
        "application_insights_results": [],
        "other_results": []

If no problems are detected, an empty JSON document is returned.

For more information, see the Workspace reference.

For more information, see the Workspace.diagnose_workspace() reference.

Next steps