Home › Studies › AZ-104 › Compute › Virtual Machines

Virtual Machines

create · resize · managed disks · caching · Trusted Launch · Spot · Hybrid Benefit

By the tools4free.dev team · Last reviewed November 13, 2026

Practice questions for this topic →

Create a VM

Resize a VM

Managed disk types

TypeOS disk?Max sizeMax IOPSMax throughputNotes
Ultra DiskNo65,536 GiB400,00010,000 MB/sCreated empty as a data disk. No availability sets, no host caching, LRS only (single VM or availability zone). Size from 4 GiB.
Premium SSD v2No65,536 GiB80,0002,000 MB/sNo host caching. Baseline 3,000 IOPS and 125 MB/s free. Size from 1 GiB.
Premium SSDYes32,767 GiB20,000900 MB/sP10 128 GiB 500 IOPS; P20 512 GiB 2,300; P30 1,024 GiB 5,000; P50 4,096 GiB 7,500.
Standard SSDYes32,767 GiB6,000750 MB/s
Standard HDDYes (retiring as OS disk Sep 8, 2028)32,767 GiB2,000 (3,000 with performance plus)500 MB/sMigrate OS disks to Standard SSD or Premium SSD.

Disk operations

TaskWhat to know
Change disk typeDeallocate the VM (it restarts). Managed disks only: convert unmanaged first. Only two changes per day. Standard to Premium needs a Premium-capable VM size. Order: deallocate, resize to a Premium-capable size if needed, az disk update --sku Premium_LRS, start. Valid SKUs: Standard_LRS, StandardSSD_LRS, StandardSSD_ZRS, Premium_ZRS, Premium_LRS. Portal: VM stopped › Disks › disk › Size + performance › Account type.
Switch to or from Ultra DiskNot direct. Migrate with an incremental snapshot (512 logical sector size).
Change Ultra or Premium SSD v2 performanceNo restart. Up to four performance resizes per 24 hours (creation counts as one for Premium SSD v2). Ultra can take up to an hour to apply.
Attach a new data diskVM › Disks › Create and attach a new disk › Save. Then initialize it in the OS (Disk Management). Disks of 2 TiB or more must use GPT; smaller disks can use MBR or GPT. Only initialize and format new empty disks.
Expand a diskUsually deallocate the VM, except data disks that qualify for expand without downtime. Disks of 4 TiB or less need deallocation and detach to go beyond 4 TiB. OS disk max is 4,095 GiB. MBR limits usable size to 2 TiB. Shrinking is not supported.
After expandingExtend the volume in the OS (DiskPart extend or Disk Management). Expanding the disk and extending the volume are separate steps. Striped volumes cannot be expanded.

Trusted Launch, Spot and Hybrid Benefit

FeatureFacts
Trusted LaunchThe default for newly created Gen2 VMs and scale sets (portal, CLI and PowerShell). Gen2 only. Uses Secure Boot, vTPM and optional boot integrity monitoring through Defender for Cloud. No extra VM price. Can be enabled on existing Gen2 VMs; Gen1 VMs can be upgraded to Gen2 with Trusted Launch. Not supported: Managed Image and Linux VM hibernation.
Spot VMUses unused capacity at a discount, with no SLA. Azure can evict with 30 seconds notice (best effort, through Scheduled Events). Eviction policy: Deallocate (default) or Delete. A deallocated Spot VM still counts against quota and incurs disk storage charges. Delete removes the VM and its disks. B-series and promo sizes are not supported. Spot can only be set at creation.
Spot max price-1 avoids price-based eviction (you never pay above the standard price). A max price below the current price means the VM is not deployed. To change max price, deallocate first. A VM evicted for price is not restarted automatically.
Azure Hybrid Benefit (Windows Server)Needs on-premises Windows Server core licenses with active Software Assurance or qualifying subscription licenses. Minimum 8 core licenses per VM. License type Windows_Server. Converting an existing VM changes only a metadata licensing flag and does not restart the VM.

CLI and PowerShell

TaskAzure CLIPowerShell
List resize optionsaz vm list-vm-resize-options -g <rg> -n <vm>Get-AzVMSize -ResourceGroupName <rg> -VMName <vm>
Resizeaz vm resize -g <rg> -n <vm> --size Standard_DS3_v2$vm.HardwareProfile.VmSize='…'; Update-AzVM -VM $vm -ResourceGroupName <rg>
Deallocate / startaz vm deallocate / az vm startStop-AzVM / Start-AzVM
Change disk typeaz disk update --sku Premium_LRS -n <disk> -g <rg>$disk.Sku=[…DiskSku]::new('Premium_LRS'); $disk | Update-AzDisk
Expand a disk$disk.DiskSizeGB=1023; Update-AzDisk -ResourceGroupName <rg> -Disk $disk -DiskName $disk.Name
Set host caching to None on a LUNaz vm update -g <rg> -n <vm> --disk-caching 0=None
Create a VM (simple)az vm create -n MyVm -g MyRG --image Ubuntu2204 --size Standard_D2s_v5 --generate-ssh-keysNew-AzVM -ResourceGroupName MyRG -Name MyVm -Credential (Get-Credential) -Image <img> -Size <size> -Zone 1
Create a Spot VMaz vm create … --priority Spot --eviction-policy Deallocate --max-price -1New-AzVM … -Priority Spot -EvictionPolicy Deallocate
Enable Hybrid Benefitaz vm update -g MyRG -n MyVm --set licenseType=Windows_Server$vm.LicenseType="Windows_Server"; Update-AzVM -ResourceGroupName MyRG -VM $vm (None reverts)
Trusted Launchaz vm create … --security-type TrustedLaunchNew-AzVM … -SecurityType TrustedLaunch

Exam Tips

Tick each tip once you can answer it without looking.

“Resize a running VM to a bigger size” → The VM restarts, and may need to be deallocated if the size is not on its cluster. Trap: assuming no downtime.

“The size you want is not listed for a running VM” → Deallocate the VM, then look again. Trap: recreating the VM.

“Resize a VM in an availability set when the size is not on the cluster” → Deallocate all VMs in the availability set. Trap: resizing only the one VM.

“Premium Storage workload on a Standard_E4_v3” → Use an “s” size such as Standard_E4s_v3. Trap: E4_v3 has no Premium Storage support.

“Convert a Standard SSD data disk to Premium SSD” → Deallocate the VM, use a Premium-capable size, update the disk SKU. Trap: detaching the disk is not part of the documented steps.

“Change an existing disk to Ultra Disk” → Not directly: use an incremental snapshot and create a new disk. Trap: az disk update --sku UltraSSD_LRS.

“Ultra Disk in an availability set” → Not supported (single VM or availability zone only).

“Shrink a managed disk” → Not supported: create a new smaller disk and copy the data.

“Disk expanded but the volume is the same size” → Extend the volume in the OS (DiskPart or Disk Management). Trap: restarting alone.

“Initialize a data disk of more than 2 TiB” → GPT. Trap: MBR limits usable size to 2 TiB.

“Raise Ultra Disk IOPS without downtime” → Change the performance at runtime (up to four changes per 24 hours). Trap: detaching the disk.

“A new Gen2 VM from the portal: which security feature is on by default” → Trusted Launch (Secure Boot and vTPM). Trap: Confidential VM or Azure Disk Encryption.

“Interruptible batch workload at the lowest cost” → Spot VM (eviction policy Deallocate, or Delete to drop disks). Trap: expecting an SLA or high availability guarantees.

“Spot VM must not be evicted because of price” → Max price -1. Trap: a max price below the current price: the VM is not deployed.

“Change the max price of a Spot VM” → Deallocate first, then update. Trap: changing it while the VM runs.

“Turn an existing standard VM into a Spot VM” → Not possible: Spot is set at creation. Trap: a portal toggle.

“Use existing Windows Server licenses with Software Assurance on an existing VM” → Set licenseType to Windows_Server: no restart. Trap: redeploying the VM.

“Default host caching for a new data disk” → ReadOnly (OS disk: ReadWrite). Trap: None or ReadWrite for data disks.

“Enable host caching on an 8 TiB data disk” → Not supported on disks of 4 TiB or more.

“az vm create on a Windows image with no --nsg-rule” → An RDP rule is created; --nsg-rule NONE creates none.

Sources

Checked against Microsoft Learn on November 13, 2026.

← ARM Templates & BicepDisk Encryption →