Understanding Azure Policy
This lesson explains definitions, initiatives, assignments and effects, and how policy differs from RBAC.
Learning outcomes
After completing this lesson, you will be able to:
- Distinguish Azure Policy from RBAC.
- Describe definitions, initiatives and assignments.
- Choose a policy effect.
- Explain how existing resources are remediated.
Why policy is separate from access control
Azure RBAC answers the question of what a person may do. Azure Policy answers a different question: what properties must a resource have? A person with Contributor rights can create a storage account, and RBAC has no opinion about whether that account allows public access. Policy does. The two work together, and neither replaces the other. A useful test when reading a scenario is to ask whether the requirement concerns who acts, which points to RBAC, or what may exist, which points to policy.
Policy evaluates resources when they are created or changed, and it also scans existing resources periodically, about every 24 hours. It can therefore both stop a new problem and report an old one.
RBAC or Azure Policy?
Definitions, initiatives and assignments
Three objects make up the system.
- A policy definition holds the rule. It says which resources to evaluate and what effect to apply. Azure supplies many built-in definitions.
- An initiative, also called a policy set, groups related definitions so that they can be assigned and tracked together. The Microsoft Cloud Security Benchmark is an initiative.
- An assignment applies a definition or initiative to a scope, with parameters and optional exclusions.
An assignment at a management group flows down to everything beneath it, which makes policy the natural tool for organization-wide rules. A child scope cannot weaken it, although an exclusion on the assignment can leave out a scope, and an exemption can record a justified exception for a resource, with an expiry date.
The following diagram shows how definitions, initiatives and assignments relate.

Policy effects
The effect decides what happens when a resource matches. The following table lists the effects that security engineers use most, and they are worth learning by what each one does at the moment of the request and afterwards.
| Effect | On a new or changed resource | On an existing resource | Needs a managed identity |
|---|---|---|---|
| Deny | Rejects the request with a 403 error | Reports it as noncompliant | No |
| Audit | Allows it, and records a warning | Reports it as noncompliant | No |
| Modify | Adds or changes properties or tags during the request | Fixed by a remediation task | Yes |
| Append | Adds fields to the request | Reports it as noncompliant | No |
| AuditIfNotExists | Checks for a related resource, and reports if it is absent | Reports it as noncompliant | No |
| DeployIfNotExists | Deploys a related resource if it is absent | Fixed by a remediation task | Yes |
| Disabled | Does nothing | Does nothing | No |
A common approach is to assign a new policy with Audit first, examine the compliance results, and then move to Deny. Policies with Deny can break deployments, so a sudden change may stop legitimate work. Many built-in definitions take the effect as a parameter, so the same definition can move from one to the other. The DoNotEnforce enforcement mode also lets you see the results of an assignment without applying the effect.
The following diagram shows which effects act during a request and which act on existing resources.

Policy effects
Remediating existing resources
A new assignment does not change anything that already exists. For Modify and DeployIfNotExists policies, a remediation task corrects existing resources. The assignment uses a managed identity, which needs roles that are sufficient for the change, because the identity rather than the original deployer makes the correction.
A policy that deploys diagnostic settings to all key vaults shows the pattern. New vaults receive the setting automatically through the policy. Existing vaults are marked noncompliant until a remediation task is run. If that task fails, the likely cause is a role missing from the identity, or a network rule that blocks the deployment.
Evaluation order and interaction
If several assignments apply, all are evaluated, and the outcome is the most restrictive one. A Deny from any assignment stops the request, so policies do not need a priority. Policy is evaluated by Azure Resource Manager, after the RBAC check. A user without the right role is rejected by RBAC first, and a user with the right role can still be rejected by policy.
Because policy works on Resource Manager properties, it cannot see inside a virtual machine. Settings in the guest operating system need Azure Machine Configuration, which is delivered through policy and is described in a later module.
How policies combine
Choosing an effect
A company requires that all storage accounts have public blob access disabled. New accounts that violate this must be stopped. The company has 300 existing accounts, and it must see which ones violate the rule before changing them. What should you do?
The built-in definition for public blob access has a parameterized effect. Assign it first with Audit at a management group, and review the compliance page to identify the existing accounts. Work with the owners, and then change the effect to Deny so that new violations are stopped.
Starting with Deny would stop new accounts, but it might block a legitimate update to an existing account that is still noncompliant. A remediation task is not available for a Deny or Audit effect, because it applies only to Modify and DeployIfNotExists. An RBAC role cannot express the rule, since it concerns a property rather than an action.
Which identity makes the change during a DeployIfNotExists remediation?
Show answer
The assignment's managed identity, which must hold roles sufficient for the change.
Exam Tips
Remember for the exam
- Policy governs what exists; RBAC governs who acts.
- Audit first, then Deny.
- Modify and DeployIfNotExists need a managed identity and a remediation task for existing resources.
- A Deny from any assignment stops the request.