ワークスペース診断を使う方法

適用対象:Python SDK azureml v1

Azure Machine Learning には、ワークスペースの問題を特定するために使用できる診断 API が用意されています。 診断レポートで返されるエラーには、問題の解決方法に関する情報が含まれています。

Azure Machine Learning スタジオまたは Python SDK からワークスペース診断を使用できます。

前提条件

この記事の手順に従う前に、次の前提条件が満たされていることをご確認ください。

Studio からの診断

Azure Machine Learning スタジオから、ワークスペースの診断を実行して、セットアップを確認することができます。 診断を実行するには、ページの右上隅にある [?] アイコンを選択します。 次に、 [Run workspace diagnostics](ワークスペース診断の実行) を選択します。

ワークスペース診断ボタンのスクリーンショット。

診断の実行後、検出された問題の一覧が返されます。 この一覧には、考えられる解決策へのリンクが含まれています。

Python からの診断

次のスニペットは、Python からワークスペースの診断を使う方法を示しています。

適用対象: Python SDK azure-ai-ml v2 (現行)

from azure.ai.ml import MLClient
from azure.ai.ml.entities 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).result()
# Inspect the attributes of the response you are interested in
for result in resp.application_insights_results:
    print(f"Diagnostic result: {result.code}, {result.level}, {result.message}")

応答は、ワークスペースで検出されたすべての問題に関する情報を含む DiagnoseResponseResultValue オブジェクトです。

適用対象:Python SDK azureml v1

from azureml.core import Workspace

ws = Workspace.from_config()

diag_param = {
      "value": {
      }
    }

resp = ws.diagnose_workspace(diag_param)
print(resp)

応答は、ワークスペースで検出されたすべての問題に関する情報を含む JSON ドキュメントです。 次の JSON は応答の例です。

{
    "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/<myresourcegroup>/providers/Microsoft.Network/privateEndpoints/<workspace-private-endpoint>' is not using Azure default DNS. You need to configure your DNS server and check https://learn.microsoft.com/azure/machine-learning/how-to-custom-dns to make sure the custom DNS is set up correctly."
        }],
        "storage_account_results": [],
        "key_vault_results": [],
        "container_registry_results": [],
        "application_insights_results": [],
        "other_results": []
    }
}

問題が検出されない場合は、空の JSON ドキュメントが返されます。

詳細については、ワークスペースに関するリファレンスを参照してください。

詳細については、Workspace.diagnose_workspace() のリファレンスを参照してください。

次のステップ