You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Terraform在Azure ML Studio创建数据存储遇参数问题求助

问题解决:Terraform 创建 Azure ML Blob 数据存储的参数错误修正

错误原因分析

  1. 初始报错要求tenant_id/client_id等参数,是AzureML Provider 全局配置缺失导致的,而非数据存储资源的auth块需要这些参数。
  2. 后续添加subscription_id后报错,是因为该参数不属于AccountKey认证模式下的auth块参数范畴,属于配置冗余。

正确配置方案

第一步:配置 AzureML Provider 全局参数

在代码开头添加 Provider 配置块,填入你的租户、服务主体及订阅信息(这些是 Provider 初始化必需的全局参数,而非资源级参数):

provider "azureml" {
  tenant_id       = "你的租户ID"
  client_id       = "你的服务主体ID"
  client_secret   = "你的服务主体密钥"
  subscription_id = "你的订阅ID"
}

第二步:修正数据存储资源代码

使用AccountKey认证模式时,auth块仅需指定认证类型和存储账户主键,删除所有多余的AD相关参数:

resource "azureml_datastore" "output_datastore" {
  resource_group_name = var.resource_group_name
  workspace_name      = azurerm_machine_learning_workspace.AML.name
  name                = "outputdatastore"
  storage_type        = "AzureBlob"
  
  storage_account_name   = "bapstorageaccount945"
  storage_container_name = "predictioncontainer"
  
  auth {
    credentials_type = "AccountKey"
    account_key      = "你的存储账户主键"
  }  
}

额外注意事项

  • 确保配置的服务主体拥有目标存储账户的Storage Blob Data Contributor角色权限,避免后续出现访问权限错误。
  • 若存储账户与ML工作区在同一订阅下,Provider配置的订阅ID会自动关联,无需在资源中重复指定。

内容的提问来源于stack exchange,提问作者Manoj R

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.19 18:50:30