使用Azure CLI创建Machine Learning工作区失败,求解决方案
解决Azure CLI创建ML工作区时的"Missing dependent resources"错误
执行以下Azure CLI命令创建Azure Machine Learning工作区时:
az ml workspace create --name "rg-dp100-labs" --resource-group "rg-dp100-labs"
收到错误:
Code: ValidationError Message: Missing dependent resources in workspace json Target: workspace Exception Details: (Invalid) Missing dependent resources in workspace json Code: Invalid Message: Missing dependent resources in workspace json Target: workspace
仅Key Vault和存储账户被成功创建,工作区创建失败。
解决方法
1. 显式指定所有依赖资源名称
Azure ML工作区依赖4种核心资源:存储账户、Key Vault、Application Insights、Container Registry。默认情况下CLI会自动生成资源名称,但偶尔会出现自动创建异常。手动指定资源名称,可强制CLI完成创建或关联操作:
az ml workspace create --name "rg-dp100-labs" --resource-group "rg-dp100-labs" \ --storage-account "stordp100labs" \ --key-vault "kvdp100labs" \ --application-insights "aidp100labs" \ --container-registry "acrdp100labs"
注:资源名称需符合Azure命名规则,且在目标区域内唯一。
2. 手动创建缺失的依赖资源
若仅生成了Key Vault和存储账户,可手动创建剩余的Application Insights和Container Registry,之后重新执行工作区创建命令:
- 创建Application Insights:
az monitor app-insights component create --app "aidp100labs" --resource-group "rg-dp100-labs" --location <你的区域>
- 创建Container Registry:
az acr create --name "acrdp100labs" --resource-group "rg-dp100-labs" --sku Basic --location <你的区域>
资源创建完成后,重新运行工作区创建命令,CLI会自动关联已存在的资源。
3. 更新Azure CLI及ML扩展
旧版本的Azure CLI或ML扩展可能存在已知bug,更新到最新版本后重试:
# 更新Azure CLI az upgrade # 更新ML扩展 az extension update -n ml
4. 使用ARM模板部署
若CLI方式持续失败,可采用ARM模板一次性部署工作区及所有依赖资源,这种方式稳定性更高,且支持自定义所有资源的配置细节。
内容的提问来源于stack exchange,提问作者mobadara
相关产品推荐
相关产品推荐

