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

时间:2021-06-06 14:01:52

标签: azure azure-devops terraform azure-policy

我正在尝试使用 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"
  }

}


0 个答案:

没有答案