A platform team wants to prevent engineers from creating VM sizes that are not approved, but they also need the engineers to be able to restart their own VMs. Which two statements are correct? Select two.
Azure Policy enforces admission control at deployment time: a policy definition with a Deny effect (commonly using the "Allowed virtual machine SKUs" built-in or a custom policy) blocks any Azure Resource Manager (ARM) request that tries to create a VM with a size not present in the allowed list. Because policy evaluation happens before resource creation, even attempts from Terraform, Bicep, or the portal will be rejected, making this the precise mechanism to prevent engineers from deploying unapproved VM sizes.
Why this answer
Azure Policy can enforce organizational standards by denying the creation of non-approved VM sizes through built-in policies like 'Allowed virtual machine SKUs'. This prevents engineers from provisioning unapproved VM sizes at the time of creation, ensuring compliance without blocking other actions. Option B is correct because Azure RBAC allows granular permission assignment, such as granting the 'Microsoft.Compute/virtualMachines/restart/action' to engineers, enabling them to restart their own VMs without granting broader management rights.
Exam trap
The trap here is confusing Azure Policy (which enforces compliance on resource creation) with Azure RBAC (which controls permissions on existing resources), leading candidates to incorrectly assign policy to grant permissions or RBAC to deny creation.
Why the other options are wrong
Azure Policy cannot grant permissions; it only enforces compliance rules. Granting restart permission is an RBAC function, not a Policy capability.
Resource locks prevent deletion or modification of resources but cannot restrict VM sizes to approved types; they operate at a resource level, not on configuration properties like SKU.
Tags are metadata labels, not security enforcement mechanisms. They cannot enforce approved VM sizes or grant restart permissions; Azure Policy and RBAC are required for those actions.
When would these options actually be correct?
In a scenario where you need to automatically grant a role (e.g., Contributor) to a VM only when it is compliant with a policy (e.g., has specific tags), you could use Azure Policy with a DeployIfNotExists effect to assign an RBAC role. This would be correct if the question asked for automating role assignment based on compliance.
In a scenario where an administrator wants to prevent accidental deletion or modification of a critical VM, a resource lock (e.g., CanNotDelete) would be the correct solution.
In a scenario where the question asks for a method to categorize VMs by approval status and trigger compliance workflows, tags could be used to mark approved VM sizes, and an automation runbook could restart tagged VMs.
Why candidates pick the wrong answer
Candidates may confuse Azure Policy's ability to enforce compliance with granting permissions, or think that Policy can directly assign RBAC roles as part of its effects.
Candidates may confuse resource locks with policy enforcement, thinking locks can restrict resource configurations like VM sizes, when locks only protect against deletion or changes.
Candidates may overestimate the capabilities of tags, thinking they can be used for access control or policy enforcement, when they are only for organization and automation triggers.