Azure Terraform 策略错误“缺少订阅 - 请求没有订阅或有效的租户级资源提供程序”

问题描述

我正在尝试使用 terraform 应用 Azurerm_policy_assignment - 我无法应用策略分配,看起来像是与身份相关的问题:

policy.AssignmentsClient#Create: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="MissingSubscription" Message="The request did not have a subscription or a valid tenant level resource provider

以下是我尝试运行的代码

resource "azurerm_policy_assignment" "policyassignment" {
  name                 = "policy1assignment"
  scope                = var.policyscope
  policy_deFinition_id = "/providers/Microsoft.Authorization/policySetDeFinitions/jfda8af9-198f-asa3-1234-dsa8dfs090fsd"
  description          = "TestPolicy"
  display_name         = "TestPolicy"
  location             = var.location
  identity {
        type = "SystemAssigned"
  }

}


解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)