
close
close
In this post, I will show you how to enforce or audit governance to Azure subscriptions or resource groups using Azure Policy.
It is possible to deploy a single policy definition to a management group, subscription, or resource group. That is pretty quick and easy to do. However, like with most quick and easy things, it’s not the best way in the long run. Microsoft recommends that you deploy a policy initiative instead:
advertisment
The result is something like Active Directory Group Policy Objects (GPOs) for Azure; an initiative creates an organizational policy that can be deployed, effectively reusing components. General rules can be deployed at a top level (a management group) and more specific initiatives can be deployed at the subscription or resource group level.
Azure Policy uses inheritance. By default, everything beneath the assignment picks up the policy/initiative. For example, if I deploy an initiative at the root management group, all subscriptions within the management group hierarchy will inherit the policies, all resource groups within the subscriptions will inherit the policies, and all resources within the subscriptions will inherit the policies.
You can select exclusions in an assignment. For example, you can prevent the creation of Internet-connected network resources in a management group hierarchy but exclude a particular subscription from that policy. Combined with role-based access control, this can be a powerful way to limit features of Azure to certain teams.
You can find Azure Policy in the Azure Portal. Click All Services. Search for and launch Policy. Once there, click Definitions. The screen is split in two:
Azure Policy Definitions [Image Credit: Aidan Finn]
advertisment
Entering the Basic Information of a New Azure Policy Initiative Definition [Image Credit: Aidan Finn]
Adding Policy Definitions to an Azure Policy Initiative Definition [Image Credit: Aidan Finn]
In the below example, I have added two policies, each of which requires a single parameter. The first policy, deploying a Log Analytics (OMS) agent to virtual machines, is set with a value that will be applied to all machines (a Log Analytics workspace).
The second policy, which restricts virtual machine series/sizes, is being left undecided at this time. The administrator can decide this value with each assignment of the initiative policy, allowing different virtual machine sizes for different resource groups in this subscription.
Configuring Parameters in an Azure Policy Initiative Definition [Image Credit: Aidan Finn]
advertisment
The new initiative definition is listed in Azure Policy. Select the initiative definition and click Assign to deploy this set of policies to a target, such as a resource group. The Assign Initiative blade is pretty simple:
Note that any parameters that were set (Set Value) in the initiative definition are hardcoded and are not listed here.
Assigning an Azure Policy Initiative Definition [Image Credit: Aidan Finn]
More in Microsoft Azure
Build 2022: Microsoft's Intelligent Data Platform Combines Data and Analytics
May 25, 2022 | Rabia Noureen
Microsoft Revises Restrictive Cloud Licensing Policies to Avoid EU Antitrust Probe
May 19, 2022 | Rabia Noureen
Microsoft's Azure AD Conditional Access Service Can Now Require Reauthentication
May 13, 2022 | Rabia Noureen
Microsoft Addresses Cross-Tenant Database Vulnerability in Azure PostgreSQL
Apr 29, 2022 | Rabia Noureen
Microsoft Simplifies IT Monitoring with New Azure Managed Grafana Service
Apr 19, 2022 | Rabia Noureen
Most popular on petri