chapter twelve

12 Governing your subscriptions using Azure Policy

 

This chapter covers

  • The benefits of using Azure Policy
  • Using the built-in policies
  • Writing, testing, and deploying custom policies
  • Reviewing the current compliance status and improving it

All the examples and scenarios you have seen so far were relatively small. They covered mostly one application or were deployed to one or two subscriptions. When that is the case, it is straightforward to keep track of what resources you have running in Azure and to make sure that your solution is secure, compliant, and cost-effective. When your cloud workload gets bigger, that is much harder to do. Luckily, Azure has a built-in feature called Azure Policy that can help you govern your Azure resources, and you can use Azure Policy with Infrastructure as Code, which is then often called Policy as Code. In this chapter, you will learn how to use Azure Policy to govern Azure architectures.

Imagine you work at an enterprise organization that wants to make the move to the Azure cloud. Currently, all the teams run their applications and infrastructure in one or more on-premises data centers. What is often done in such a situation is that you build something called a landing zone in Azure and use a hub and spoke architecture.

12.1 Azure Policy

12.1.1 Policy definitions

12.1.2 Initiatives or policy sets

12.1.3 Assignment

12.2 Examining the built-in policies and initiatives

12.3 Using custom policies

12.3.1 Creating a custom policy

12.3.2 Testing a policy

12.4 Using the different effects

12.4.1 Append effect

12.4.2 Audit effect

12.4.3 AuditIfNotExists effect

12.4.4 DeployIfNotExists effect

12.4.5 Disabled effect