A policy assignment is when you apply a specific policy or set of policies to a scope, such as a subscription or resource group, to enforce rules and effects on resources.
Click to reveal answer
beginner
What does compliance mean in the context of Azure Policy?
Compliance means how well your resources follow the rules set by the assigned policies. It shows which resources meet or break the policy requirements.
Click to reveal answer
beginner
How can you check the compliance state of your resources in Azure?
You can check compliance by viewing the compliance dashboard in the Azure portal, which shows the percentage of resources compliant or non-compliant with assigned policies.
Click to reveal answer
intermediate
What is the difference between a policy definition and a policy assignment?
A policy definition is the rule or set of rules you want to enforce. A policy assignment is when you apply that definition to a specific scope to make it active.
Click to reveal answer
intermediate
Why is it important to assign policies at the right scope?
Assigning policies at the right scope ensures that only the intended resources are affected, helping to manage compliance efficiently without unintended restrictions.
Click to reveal answer
What is the main purpose of assigning a policy in Azure?
ATo backup data automatically
BTo create virtual machines
CTo monitor network traffic
DTo enforce rules on resources
✗ Incorrect
Assigning a policy enforces rules on resources to ensure compliance.
Where can you assign an Azure policy?
AOnly on individual resources
BOnly at the subscription level
CAt management group, subscription, or resource group levels
DOnly on virtual networks
✗ Incorrect
Policies can be assigned at management group, subscription, or resource group scopes.
What does a non-compliant resource mean in Azure Policy?
AThe resource does not meet the policy rules
BThe resource is encrypted
CThe resource is offline
DThe resource is deleted
✗ Incorrect
Non-compliant means the resource breaks the rules set by the assigned policy.
Which Azure feature shows the overall compliance status of your resources?
AAzure Policy compliance dashboard
BAzure Security Center
CAzure Monitor
DAzure Advisor
✗ Incorrect
The Azure Policy compliance dashboard shows compliance status of resources.
What happens if you assign a policy at a resource group level?
AIt applies to all subscriptions
BIt applies only to resources in that resource group
CIt applies to all resource groups
DIt applies only to virtual machines
✗ Incorrect
Policy assignment at resource group scope affects only resources inside that group.
Explain how policy assignments help maintain compliance in Azure.
Think about how applying rules to groups of resources helps keep them following standards.
You got /4 concepts.
Describe the steps to check and interpret compliance results in Azure Policy.
Consider how you would find out if your resources follow the rules and what to do if they don't.
You got /3 concepts.
Practice
(1/5)
1. What is the main purpose of a policy assignment in Azure?
easy
A. To monitor network traffic in real-time
B. To create virtual machines automatically
C. To apply rules to cloud resources to control their behavior
D. To backup data to external storage
Solution
Step 1: Understand policy assignment role and compare options
Policy assignments are used to enforce rules or standards on Azure resources. Only To apply rules to cloud resources to control their behavior describes applying rules to control resource behavior, which matches policy assignments.
Final Answer:
To apply rules to cloud resources to control their behavior -> Option C
Quick Check:
Policy assignment = apply rules [OK]
Hint: Policies control resources by applying rules [OK]
Common Mistakes:
Confusing policy assignments with resource creation
Thinking policies monitor traffic or backup data
Mixing policy assignments with alerts or logs
2. Which of the following is the correct way to assign a policy to a resource group using Azure CLI?
easy
A. az policy assignment create --name MyPolicy --scope /subscriptions/{subId}/resourceGroups/{rgName} --policy {policyDefinitionId}
B. az policy create --name MyPolicy --resource-group {rgName} --policy {policyDefinitionId}
C. az group policy assign --name MyPolicy --resource-group {rgName} --definition {policyDefinitionId}
D. az policy assign --name MyPolicy --scope {rgName} --definition {policyDefinitionId}
Solution
Step 1: Recall Azure CLI syntax for policy assignment and validate options
The correct command uses 'az policy assignment create' with --name, --scope, and --policy parameters. az policy assignment create --name MyPolicy --scope /subscriptions/{subId}/resourceGroups/{rgName} --policy {policyDefinitionId} matches the correct syntax. Others use incorrect commands or parameters.
Final Answer:
az policy assignment create --name MyPolicy --scope /subscriptions/{subId}/resourceGroups/{rgName} --policy {policyDefinitionId} -> Option A
Hint: Use 'az policy assignment create' with --scope for resource group [OK]
Common Mistakes:
Using 'az policy create' instead of 'az policy assignment create'
Confusing resource group with scope format
Using wrong parameter names like --definition
3. Given this Azure Policy assignment compliance result: {"complianceState": "NonCompliant", "resourceId": "/subscriptions/123/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1"} What does this indicate?
medium
A. The compliance state is unknown for vm1
B. The virtual machine vm1 follows the assigned policy rules
C. The policy assignment failed to apply to vm1
D. The virtual machine vm1 does not follow the assigned policy rules
Solution
Step 1: Interpret complianceState value and match to meaning
The value 'NonCompliant' means the resource does not meet the policy requirements. Since vm1 is NonCompliant, it does not follow the assigned policy rules.
Final Answer:
The virtual machine vm1 does not follow the assigned policy rules -> Option D
Quick Check:
NonCompliant means policy not followed [OK]
Hint: NonCompliant means resource breaks policy rules [OK]
Common Mistakes:
Assuming NonCompliant means policy applied successfully
Confusing NonCompliant with Unknown or Compliant
Thinking complianceState shows assignment failure
4. You assigned a policy to a subscription but the compliance report shows no data. What is the most likely cause?
medium
A. The resources are not evaluated yet or policy evaluation is delayed
B. The policy definition is missing required parameters
C. The policy assignment scope is incorrect or too broad
D. The policy assignment was created with the wrong Azure CLI command
Solution
Step 1: Understand policy evaluation timing and eliminate other causes
Policy compliance data can take time to appear after assignment due to evaluation delays. Incorrect scope or missing parameters usually cause errors, not empty compliance. Wrong CLI command would fail assignment.
Final Answer:
The resources are not evaluated yet or policy evaluation is delayed -> Option A
Quick Check:
Compliance delay causes no data [OK]
Hint: Wait for policy evaluation to update compliance data [OK]
Common Mistakes:
Assuming wrong CLI command always causes no data
Thinking missing parameters prevent compliance data
Ignoring evaluation delay after assignment
5. You want to enforce a policy that requires all storage accounts to have secure transfer enabled. You assign this policy at the subscription level with a parameter to exclude a specific resource group. What will happen to storage accounts in that excluded resource group?
hard
A. They will be evaluated but allowed to be non-compliant
B. They will not be evaluated or enforced by the policy
C. They will be forced to enable secure transfer regardless of exclusion
D. The policy assignment will fail due to conflicting parameters
Solution
Step 1: Understand policy exclusion parameter effect and confirm behavior on excluded resources
Excluding a resource group means resources there are not evaluated or enforced by the policy. Excluded storage accounts are ignored by the policy, so no enforcement or compliance checks occur.
Final Answer:
They will not be evaluated or enforced by the policy -> Option B
Quick Check:
Exclusion skips evaluation and enforcement [OK]
Hint: Exclusions skip policy evaluation and enforcement [OK]
Common Mistakes:
Thinking excluded resources are still checked but allowed