AZ-900
Azure governance: Policy, RBAC, resource locks and tags
What Azure Policy, Azure RBAC, resource locks and tags each control, how they inherit through scopes, and how to tell them apart on AZ-900.
Four tools, four different questions
Azure governance tools are easy to mix up because they all apply to the same resources. The quickest way to separate them is by the question each one answers:
- Azure role-based access control (RBAC): who can do what?
- Azure Policy: what are resources allowed to look like?
- Resource locks: can this resource be deleted or changed at all?
- Tags: how do we label and group resources?
Scopes and inheritance
All four apply within the Azure hierarchy: management groups contain subscriptions, subscriptions contain resource groups, and resource groups contain resources.
RBAC role assignments, policy assignments and locks are inherited downward. Assign the Reader role on a subscription and the user can read every resource group and resource in it. Tags are the exception: a tag on a resource group is not copied to the resources inside it by default.
Azure RBAC
RBAC controls access by assigning a role to a security principal (a user, group, service principal or managed identity) at a scope. A role is a list of allowed actions.
Common built-in roles are Owner (full access, including granting access to others), Contributor (create and manage resources, but cannot grant access), Reader (view only) and User Access Administrator (manage access only). You can also create custom roles.
Good practice is least privilege: give people only the role they need at the narrowest scope that works. A developer who manages one app's resources should get Contributor on that app's resource group, not on the subscription.
Azure Policy
Azure Policy evaluates resource properties against rules. A policy definition might say "VMs may only be created in West Europe and North Europe" or "storage accounts must not allow public blob access". Group related definitions into an initiative, and assign either one to a scope.
Each policy has an effect. Audit records non-compliant resources without blocking them. Deny blocks new non-compliant resources. Modify and DeployIfNotExists can change or add settings, and remediation tasks can fix resources that already existed before the assignment.
The difference from RBAC matters. RBAC decides whether a user may create a VM at all. Policy decides whether that VM's configuration is allowed. An Owner still cannot create a VM in a region a Deny policy blocks.
Resource locks
Locks protect resources from accidental changes. There are two levels. CanNotDelete (shown as Delete in the portal) lets users read and modify a resource but not delete it. ReadOnly lets users read but not change or delete it.
Locks apply to everyone, including Owners. To delete a locked resource, someone with permission must first remove the lock. A lock on a resource group applies to every resource in it.
A typical use is a CanNotDelete lock on the resource group holding a production database, so a cleanup script cannot remove it by mistake.
Tags
Tags are name and value pairs, such as CostCenter: Marketing or Environment: Production. They help you filter resources, organize automation, and break down costs in Microsoft Cost Management by department or project.
Because tags are not inherited by default, teams often use Azure Policy to require a tag on new resources or to copy a tag from the resource group. That is a good example of the tools working together.
Telling them apart on the exam
Match the requirement to the tool. "Only allow resources in certain regions" or "require encryption" is Azure Policy. "Give the support team view-only access" is RBAC with the Reader role. "Prevent anyone, even administrators, from deleting this resource" is a CanNotDelete lock. "Report costs by department" is tags.
Watch for questions that need two tools. "Developers may create VMs, but only in approved sizes" needs RBAC to grant the create permission and Policy to restrict the sizes. Neither tool can do both jobs alone.
Practice questions
A company gives administrators elevated rights only for the time needed to finish a task and only for the resources involved. Which Zero Trust principle does this follow?
- Defense in depth
- Verify explicitly
- Assume breach
- Use least privilege access
Answer
D. Least privilege access limits users with just-in-time and just-enough access. Verify explicitly is about checking every request, not about how much access is granted.
AZ-900 question 33
An operator only needs to restart virtual machines in one resource group. Following the principle of least privilege, which role assignment is best?
- Owner on the whole subscription
- Virtual Machine Contributor on the resource group
- Reader on the resource group
- Contributor on the whole subscription
Answer
B. Least privilege means granting only the access needed, at the narrowest scope, which here is a VM-focused role on that one resource group. Subscription-wide Owner or Contributor grants far more than the task needs, and Reader can't restart a VM.
AZ-900 question 165
A storage account has a CanNotDelete lock. A user with the Owner role on the subscription tries to delete the storage account. What happens?
- The deletion fails until the lock is removed
- The deletion succeeds because of the Owner role
- The deletion succeeds after a second confirmation
- The lock is removed automatically and deletion goes ahead
Answer
A. Resource locks apply to every user regardless of their role, so even an Owner is blocked. The lock has to be removed first by someone who has permission to manage locks.
AZ-900 question 166
A resource group has a CanNotDelete lock. A week later, a new virtual machine is created in that resource group. Does the lock affect the new virtual machine?
- Yes, but only after the virtual machine is restarted
- No, locks on resource groups never affect resources
- No, locks cover only resources that existed at the time
- Yes, the new virtual machine inherits the lock
Answer
D. A lock applied at a parent scope is inherited by all resources in that scope, including resources added later. No restart or extra step is needed for the lock to apply.
AZ-900 question 146