Courseiva
Deploy and Manage Azure ComputehardMultiple ChoiceObjective-mapped

AZ-104 Deploy and Manage Azure Compute Practice Question

You need to resize a production VM from Standard_D2s_v5 to Standard_D4s_v5 by using Azure CLI. `az vm list-vm-resize-options` shows the target size, but `az vm resize` fails while the VM is running. Which action should you take first?

⚠ Common exam trap

Candidates often confuse 'stop' with 'deallocate' — while both halt the VM, only deallocate releases the underlying hardware reservation, which is necessary for resizing across different hardware clusters or when live resize fails.

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

Run `az vm deallocate`, then resize the VM, then start it again.

Resizing a VM to a different size often requires the VM to be in a deallocated state, especially when the new size is in a different hardware cluster or when the VM is currently running and the resize operation fails. The `az vm deallocate` command releases the underlying hardware resources, allowing the VM to be resized to any available size, including Standard_D4s_v5, and then you can start it again. This is a common requirement for production VMs when live resizing is not supported or fails.

Answer analysis

Option-by-option breakdown

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

  • Run `az vm stop`, then resize the VM.

    Why it's wrong here

    The `az vm stop` command performs a clean power-off of the guest OS, but it does not deallocate the VM, meaning the compute resources remain pinned to the current physical host. Because the VM is still allocated, Azure may not be able to move it to a host that supports the larger Standard_D4s_v5 SKU, so the resize operation can fail. Deallocation via `az vm deallocate` is what releases the host-level reservation and enables Azure to reposition the VM on compatible infrastructure.

    When this WOULD be correct

    If the question specified that the target size is available in the same cluster and the VM needs only a brief pause (e.g., for a quick configuration change), stopping the VM would be sufficient and faster than deallocating.

  • Run `az vm deallocate`, then resize the VM, then start it again.

    Why this is correct

    Azure often requires the VM to be deallocated before a size change succeeds because the target size may need different host resources. Deallocation releases the current compute allocation, which lets Azure place the VM on compatible hardware. After resizing, you start the VM again and the new size takes effect. This is the key difference between stop and deallocate in Azure operations.

  • Run `az vm restart`, then resize the VM.

    Why it's wrong here

    A restart simply reboots the operating system while preserving the VM's existing compute allocation and host placement. After a restart, the VM is still tied to its original physical node, so resizing to Standard_D4s_v5 can only succeed if that same node has enough available capacity for the larger size. The only way to break the host affinity and allow Azure to schedule the VM on a suitable node for the new SKU is to fully deallocate the VM with `az vm deallocate`.

    When this WOULD be correct

    If the question described a scenario where the VM needs to apply a new configuration or update that only takes effect after a reboot (e.g., changing disk caching settings or installing a driver), then running `az vm restart` before the operation would be the correct first step.

  • Run `az vm generalize`, then recreate the VM from the image.

    Why it's wrong here

    Generalizing a VM runs Sysprep (on Windows) or waagent -deprovision (on Linux), stripping the instance identity such as hostname, SIDs, and SSH host keys so the disk can be captured as a reusable image. Recreating from that image builds a brand-new VM with different security identifiers and configuration, which is unacceptable for an existing production workload. A routine SKU change from Standard_D2s_v5 to Standard_D4s_v5 does not require any OS-level image preparation; it only requires the compute allocation to be released.

    When this WOULD be correct

    When you need to capture a generalized image of a VM to reuse in multiple deployments, such as creating a custom image from a configured VM for scaling out.

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.

Run `az vm deallocate`, then resize the VM, then start it again.Correct answer

Why this is correct

Azure often requires the VM to be deallocated before a size change succeeds because the target size may need different host resources. Deallocation releases the current compute allocation, which lets Azure place the VM on compatible hardware. After resizing, you start the VM again and the new size takes effect. This is the key difference between stop and deallocate in Azure operations.

Run `az vm stop`, then resize the VM.Wrong answer — click to see why

Why this is wrong here

Stopping a VM (az vm stop) does not release the underlying hardware resources; resizing may still fail if the target size is unavailable in the current cluster. Deallocation is required to free the VM from its host and allow resizing to any size.

★ When this WOULD be the correct answer

If the question specified that the target size is available in the same cluster and the VM needs only a brief pause (e.g., for a quick configuration change), stopping the VM would be sufficient and faster than deallocating.

Why candidates choose this

Candidates may think stopping the VM is enough to resize, confusing 'stop' with 'deallocate', or they may want to minimize downtime by avoiding the longer deallocation process.

Run `az vm restart`, then resize the VM.Wrong answer — click to see why

Why this is wrong here

Restarting the VM does not change its allocation state; the resize operation requires the VM to be in a deallocated state (stopped and de-provisioned) to change the VM size, as the new size may require different resources. A restart only reboots the VM without releasing the underlying hardware.

★ When this WOULD be the correct answer

If the question described a scenario where the VM needs to apply a new configuration or update that only takes effect after a reboot (e.g., changing disk caching settings or installing a driver), then running `az vm restart` before the operation would be the correct first step.

Why candidates choose this

Candidates may think that restarting the VM is sufficient to free up resources or reset the state, similar to how a reboot can resolve some software issues, but they overlook that Azure VM resizing requires deallocation to release the current hardware allocation.

Run `az vm generalize`, then recreate the VM from the image.Wrong answer — click to see why

Why this is wrong here

Generalize prepares the VM for image creation and is not used for resizing; it would require recreating the VM, which is unnecessary and disruptive for a simple resize operation.

★ When this WOULD be the correct answer

When you need to capture a generalized image of a VM to reuse in multiple deployments, such as creating a custom image from a configured VM for scaling out.

Why candidates choose this

Candidates may confuse the steps for resizing with those for creating a reusable image, or they might think generalize is a necessary step before any major VM modification.

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?”

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.