An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
Hello Yasmin, Fitri
Right now Azure Policy’s DeployIfNotExists effect only supports nested template deployments at the subscription or resource group scope—not at the management group level. That means you can’t directly author a single policy with DeployIfNotExists that will go out and automatically add an Azure AD group to the Reader role on each management group.
Here are a few patterns you can use instead:
Use an Azure Blueprint
- Blueprints support RBAC artifacts at management‐group scope. You can define a Reader role assignment for your Azure AD group as part of a blueprint and assign that blueprint to your management group.
- As new management groups are onboarded you just assign the same blueprint and the role assignment is enforced.
Deploy an ARM or Bicep template at the management group scope
- You can author a management‐group‐level ARM or Bicep deployment that has a `Microsoft.Authorization/roleAssignments` resource and target `targetScope = 'managementGroup'`.
- You’d either run that once for each existing MG or trigger it via CI/CD whenever you create a new MG.
Use a script or Azure Automation/Functions
- Detect all child management groups and push out Reader assignments via Azure CLI/PowerShell (`az role assignment create --assignee <groupId> --role Reader --scope /providers/Microsoft.Management/managementGroups/<mg>`).
- Schedule it or hook it into your MG-creation process.
If you really need continuous “policy‐style” enforcement of those assignments at MG scope, Blueprint is the most turnkey path today.
Please share us below details:
• Are you OK with using Azure Blueprints for RBAC enforcement?
• Do you need this to happen automatically whenever any new management group is created?
• Are you comfortable running a CI/CD or automation runbook that targets management group scopes?
Hope that helps!
Reference docs
- Management group deployments with Bicep files: https://learn.microsoft.com/azure/azure-resource-manager/bicep/deploy-to-management-group
- Management‐group deployments with ARM templates: https://learn.microsoft.com/azure/azure-resource-manager/templates/deploy-to-management-group
- Understanding Azure Policy effects (
DeployIfNotExists/Modify): https://learn.microsoft.com/azure/governance/policy/concepts/effects - Remediating non-compliant resources (DeployIfNotExists): https://learn.microsoft.com/azure/governance/policy/how-to/remediate-resources-resources
Thanks,
Suchitra.