Azure Terraform Policy Error "Missing subscription -The request did not have a subscription or a valid tenant level resource provider"

Viewed 2184

I'm trying to apply the Azurerm_policy_assignment using Terraform - i'm unable to apply the policy assignment, looks like an identity related issue:

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

The following is the code that I am trying to run:

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 Answers
Related