Courseiva
Deploy and Manage Azure ComputemediumMultiple ChoiceObjective-mapped

AZ-104 Deploy and Manage Azure Compute Practice Question

You need to run a script inside an Azure virtual machine after deployment to install application prerequisites. Which feature should you use?

⚠ Common exam trap

Candidates often confuse Azure Policy (a governance tool) with the Custom Script Extension (a VM-level execution tool), mistakenly thinking Policy can run scripts to enforce configurations inside the VM, when in reality Policy only audits or remediates Azure resource properties, not guest OS actions.

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

A Custom Script Extension

The Custom Script Extension (CSE) is the correct feature because it allows you to run a script inside an Azure VM after deployment, making it ideal for installing application prerequisites. CSE downloads and executes scripts on the VM, supporting both Windows (via PowerShell) and Linux (via Bash) environments, and can be applied during initial provisioning or to an existing VM.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Azure Policy

    Why it's wrong here

    Azure Policy is a governance service that evaluates resource compliance against rules like allowed locations or SKUs, and it can enforce or deny resource creation, but it does not run arbitrary scripts inside a VM. While Azure Policy can include Guest Configuration to audit guest OS settings, it is not designed for executing deployment-time scripts, and the typical interpretation is policy-driven compliance, not script execution.

    When this WOULD be correct

    You need to ensure that all VMs in a subscription are deployed with a specific tag or have encryption enabled. Azure Policy would be used to audit or enforce those rules.

  • A Custom Script Extension

    Why this is correct

    The Custom Script Extension is an Azure VM extension that uses the Azure Guest Agent to download and execute a script on the VM, either during initial deployment via ARM template or on a running VM. It supports PowerShell and Bash, runs with system privileges, and is the standard way to run post-deployment configuration tasks like installing software or applying settings.

  • Boot diagnostics

    Why it's wrong here

    Boot diagnostics captures serial console logs and screenshots of the VM's startup process to help troubleshoot boot failures. It is a passive diagnostic tool that does not execute scripts; it merely records information for later analysis, so it cannot be used to run a script after deployment.

    When this WOULD be correct

    You need to troubleshoot why an Azure VM is not booting correctly after a configuration change. Boot diagnostics would provide the necessary logs and screenshots to identify the issue.

  • A proximity placement group

    Why it's wrong here

    A proximity placement group is an Azure feature that groups VMs in the same data center or region to minimize network latency for high-performance scenarios. It has no guest OS access and cannot execute scripts; its sole purpose is physical placement optimization, not configuration management.

    When this WOULD be correct

    When the question asks how to minimize network latency between VMs in a high-performance computing workload, a proximity placement group would be the correct answer.

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-104 exam frequently reuses these exact scenarios with slightly different constraints.

A Custom Script ExtensionCorrect answer

Why this is correct

The Custom Script Extension is an Azure VM extension that uses the Azure Guest Agent to download and execute a script on the VM, either during initial deployment via ARM template or on a running VM. It supports PowerShell and Bash, runs with system privileges, and is the standard way to run post-deployment configuration tasks like installing software or applying settings.

Azure PolicyWrong answer — click to see why

Why this is wrong here

Azure Policy is used to enforce compliance rules and audit resource configurations, not to run scripts inside a VM after deployment.

★ When this WOULD be the correct answer

You need to ensure that all VMs in a subscription are deployed with a specific tag or have encryption enabled. Azure Policy would be used to audit or enforce those rules.

Why candidates choose this

Candidates may confuse policy enforcement with post-deployment configuration tasks, thinking a policy can trigger script execution.

Boot diagnosticsWrong answer — click to see why

Why this is wrong here

Boot diagnostics captures serial console output and screenshots to troubleshoot VM boot failures, but it cannot run scripts or install software after deployment.

★ When this WOULD be the correct answer

You need to troubleshoot why an Azure VM is not booting correctly after a configuration change. Boot diagnostics would provide the necessary logs and screenshots to identify the issue.

Why candidates choose this

Candidates may confuse boot diagnostics with post-deployment configuration tools, thinking it can execute scripts during the boot process.

A proximity placement groupWrong answer — click to see why

Why this is wrong here

A proximity placement group is used to reduce network latency between Azure resources by ensuring they are physically close, not for running scripts or installing software on a VM after deployment.

★ When this WOULD be the correct answer

When the question asks how to minimize network latency between VMs in a high-performance computing workload, a proximity placement group would be the correct answer.

Why candidates choose this

Candidates might confuse 'placement' with 'deployment' tasks, thinking it involves post-deployment configuration, or they may not fully understand the purpose of proximity placement groups.

Analysis generated from the official AZ-104blueprint 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

About these practice questions

Courseiva writes every AZ-104 question from scratch — 1,049 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AZ-104 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-104 exam.