Deploying policies
In Azure, when you want to control how deployed resources are configured and managed, you have one option if you want to do that natively – you need to query the Azure Resource Manager API to fetch information about instances of services you’re interested in. In smaller environments, this will suffice; however, if you’re managing hundreds or thousands of different resources, executing tens of queries every day will become cumbersome and difficult. This is why Azure offers Azure Policy – a native way to audit and remediate resources that are not compliant with a set of rules established by you or your organization.
Let’s see an example of deploying a policy using the Azure CLI.
Deploying a policy using the Azure CLI
It’s possible to deploy a policy using a variety of different methods (the Azure portal, ARM templates, SDKs, and so on), but for this chapter, we’ll use the Azure CLI since it’s the most...