AZ-900 Describe Azure management and governance Practice Question
A company has an Azure subscription with 200 virtual machines. The compliance team requires that all virtual machines have diagnostic settings enabled to send metrics and logs to a central Log Analytics workspace. The team wants Azure to automatically configure these diagnostic settings on any VM that currently lacks them, without manual intervention. Which Azure Policy effect should the team use in the policy definition?
⚠ Common exam trap
Watch out — candidates often confuse Audit (which only reports) with DeployIfNotExists (which actively remediates), or mistakenly think Deny can retroactively fix existing resources when it only blocks new non-compliant deployments.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
DeployIfNotExists
The DeployIfNotExists effect is correct because it automatically deploys a diagnostic settings configuration to any VM that lacks it, ensuring compliance without manual intervention. This effect evaluates resources and, if they do not meet the condition (missing diagnostic settings), triggers a deployment to remediate them. Audit only logs non-compliance without fixing it, and Deny blocks non-compliant creation but does not remediate existing VMs.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Audit
Why it's wrong here
Audit, while useful for visibility, is purely a logging effect: it evaluates resources against the policy condition and writes compliance details (including the resource name and compliance state) to the activity log. It never invokes any deployment, alters the resource, or creates the missing diagnostics settings. Therefore, after running an audit, the 200 VMs would remain non-compliant with no configuration change, so it does not satisfy the requirement to automatically configure them.
When this WOULD be correct
Use Audit when the goal is to monitor and report on compliance status (e.g., which VMs lack diagnostic settings) without automatically remediating, such as for initial compliance assessment or manual remediation tracking.
- ✗
Deny
Why it's wrong here
Deny blocks a resource from being created or updated if it fails the policy condition, but it has no effect on resources already in existence. For these 200 existing VMs, Deny will neither deploy diagnostic settings nor make any post-hoc change; it would only stop future VM deployments that fail the requirement (e.g., a VM created without diagnostic settings would be rejected). Since the task is remediation of existing resources, Deny is insufficient.
When this WOULD be correct
A scenario where the compliance team wants to block any new VM deployment that does not include diagnostic settings from the start, such as a policy that denies creation of VMs without a specific tag or configuration.
- ✓
DeployIfNotExists
Why this is correct
DeployIfNotExists is the correct effect because it evaluates each VM for the absence of a diagnostic settings resource and, when non-compliance is detected, deploys that required resource via an ARM template or linked deployment. With a remediation task triggered through Azure Policy – and a system-assigned managed identity granted the necessary permissions – this effect can automatically create diagnostic settings for all 200 existing VMs, fully automating remediation.
- ✗
Modify
Why it's wrong here
Modify is the wrong choice because it can only alter properties on an existing resource, such as tags or configuration fields, but cannot create a separate child resource like Microsoft.Insights/diagnosticSettings. Diagnostic settings are their own resource type that must be deployed, not a settable property on a VM resource, so Modify has no ability to instantiate this child resource. Accordingly, Modify cannot drive the required automatic deployment for the 200 VMs.
When this WOULD be correct
If the requirement were to automatically add a specific tag (e.g., 'Environment: Production') to all VMs that are missing it, Modify would be the correct effect because it can alter resource properties without deploying additional resources.
Option-by-option analysis
Why each answer is right or wrong
Understanding why wrong answers are wrong — and when they would be correct — is what separates a 750 score from a 900. The AZ-900 exam frequently reuses these exact scenarios with slightly different constraints.
✓DeployIfNotExistsCorrect answer▾
Why this is correct
DeployIfNotExists is the correct effect because it evaluates each VM for the absence of a diagnostic settings resource and, when non-compliance is detected, deploys that required resource via an ARM template or linked deployment. With a remediation task triggered through Azure Policy – and a system-assigned managed identity granted the necessary permissions – this effect can automatically create diagnostic settings for all 200 existing VMs, fully automating remediation.
✗AuditWrong answer — click to see why▾
Why this is wrong here
Audit only logs non-compliant resources without taking any action to fix them, so it cannot automatically configure diagnostic settings as required.
★ When this WOULD be the correct answer
Use Audit when the goal is to monitor and report on compliance status (e.g., which VMs lack diagnostic settings) without automatically remediating, such as for initial compliance assessment or manual remediation tracking.
Why candidates choose this
Candidates may think Audit is sufficient because it detects non-compliance, but they overlook the requirement for automatic configuration without manual intervention.
✗DenyWrong answer — click to see why▾
Why this is wrong here
Deny prevents non-compliant resources from being created or updated, but it does not automatically configure diagnostic settings on existing VMs that lack them. The requirement is to remediate existing VMs, not block creation.
★ When this WOULD be the correct answer
A scenario where the compliance team wants to block any new VM deployment that does not include diagnostic settings from the start, such as a policy that denies creation of VMs without a specific tag or configuration.
Why candidates choose this
Candidates may confuse 'Deny' with a proactive enforcement mechanism, thinking it will automatically fix non-compliant resources, when in fact it only blocks actions that would create or modify resources.
✗ModifyWrong answer — click to see why▾
Why this is wrong here
Modify is used to add or change tags or resource properties, but it cannot deploy and configure diagnostic settings extensions or Log Analytics agents. DeployIfNotExists is required to deploy the diagnostic settings configuration to VMs that lack them.
★ When this WOULD be the correct answer
If the requirement were to automatically add a specific tag (e.g., 'Environment: Production') to all VMs that are missing it, Modify would be the correct effect because it can alter resource properties without deploying additional resources.
Why candidates choose this
Candidates may confuse Modify with DeployIfNotExists because both can alter resources, but Modify only changes existing properties, while DeployIfNotExists can deploy new resources or configurations.
Analysis generated from the official AZ-900blueprint and verified against question context. The “when correct” sections are what AI assistants cite when candidates ask “what’s the difference between these options?”
Go deeper
Related to this question
Learn chapter
Azure Cost Management and Billing
Key term
Azure subscription
An Azure subscription is a logical container in Microsoft Azure that provides billing isolation and access boundaries for your cloud resources and services.
Key term
Azure Policy
Azure Policy is a service in Microsoft Azure that lets you create, assign, and manage rules to ensure your resources stay compliant with your company standards and service-level agreements.
About these practice questions
One of 981 original AZ-900 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-900 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-900 exam.