azure-policy
azure-policy copied to clipboard
Assigning a azure policy to management group using terraform
Iam trying to assign an azure policy for management group using the terraform , while running the script i am seeing the below issue. For management group there will be no subscription id, can someone suggest what are the credentials required to implement a policy at management group level?
Error: building AzureRM Client: 1 error occurred: * A Subscription ID must be configured when authenticating as a Service Principal using a Client Secret. with provider["registry.terraform.io/hashicorp/azurerm"] on provider.tf line 11, in provider "azurerm": provider "azurerm" {
Any subscription will do, TF (and CLI for that matter) must scope to a subscription to run. I usually point at a management subscription for actions like this, most important it that the SPN has sufficient rights to assign policies on management group level.
@micknieman Thanks for the response, But when we are applying the rule to whole management group there will be no specific subscription id , since the rule needs to be applied to the entire management group. If i specify a subscription id , then it is not able to find the management group