Azure Management Group Subscription Association

This page shows how to write Terraform for Management Group Subscription Association and write them securely.

azurerm_management_group_subscription_association (Terraform)

The Group Subscription Association in Management can be configured in Terraform with the resource name azurerm_management_group_subscription_association. The following sections describe 2 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L12
resource "azurerm_management_group_subscription_association" "add_subscription_to_mg" {
  management_group_id = var.management_group_id
  subscription_id     = azurerm_subscription.create_subscription.id
resources.tf#L17
resource "azurerm_management_group_subscription_association" "mg_sub" {
  for_each = toset(local.subscription_ids)

  management_group_id = azurerm_management_group.mgmt_group.id
  subscription_id     = data.azurerm_subscription.sub[each.key].id
}

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Manages a Management Group Subscription Association. !> Note: When using this resource, configuring subscription_ids on the azurerm_management_group resource is not supported.

Azure Resource Manager Example

Azure Resource Manager code does not have the related resource.

Frequently asked questions

What is Azure Management Group Subscription Association?

Azure Management Group Subscription Association is a resource for Management of Microsoft Azure. Settings can be wrote in Terraform.

Where can I find the example code for the Azure Management Group Subscription Association?

For Terraform, the chaitanyagm/terraform_code and claranet/terraform-azurerm-management-group source code examples are useful. See the Terraform Example section for further details.

security-icon

Automate config file reviews on your commits

Fix issues in your infrastructure as code with auto-generated patches.