Nordlicht Reisen GmbH, a fictional travel agency, has a booking machine whose data keeps growing. The disk is running short, the data is to be encrypted, and the machine is to move to another team's resource group. Those are three exam skills: manage disks for VMs, configure Azure Disk Encryption (ADE) and move a VM to another resource group, subscription or region.
Prior knowledge. "AZ-900 compact" places Azure's storage types in lesson 2.5. How you create a machine is shown in lesson 3.3, how a Key Vault holds secrets in K3, lesson 3.3.2. This lesson is about operating: maintaining, encrypting and moving disks.
Managing disks
Types
A VM has one operating system disk and any number of data disks. Both are managed disks, of which Microsoft names five types:
| Type | What for (according to Microsoft) | Largest size | As an OS disk? |
|---|---|---|---|
| Ultra Disk | very I/O-heavy workloads, top-tier databases | 65,536 GiB | no |
| Premium SSD v2 | production with low latency, high IOPS and throughput | 65,536 GiB | no |
| Premium SSD | production with high performance and low latency | 32,767 GiB | yes |
| Standard SSD | web servers, lightly used applications, development and test | 32,767 GiB | yes |
| Standard HDD | backups and noncritical, rarely used data | 32,767 GiB | yes (ends September 8, 2028) |
According to Microsoft, Standard HDD can no longer be used as an operating system disk after September 8, 2028. Ultra Disks must be data disks and can only be created as empty disks. Premium SSD can only be used with matching VM series (sizes with s, lesson 3.3). Premium SSD v2 has no fixed size tiers: You set size and performance individually. In most regions with availability zones, Premium SSD v2 fits only zonal VMs (lesson 3.5).
Creating and attaching
Portal: open the machine, Disks, Create and attach a new disk (if your portal is set to another language, look for the same item under its translated name; the search box finds both), enter name, type and size, save.
Azure CLI, as in Microsoft's guide to managing disks:
az vm disk attach --resource-group <ressourcengruppe> --vm-name <vm-name> --name <disk-name> --size-gb 128 --sku Premium_LRS --new
Azure PowerShell:
$diskConfig = New-AzDiskConfig -SkuName Premium_LRS -Location <region> -CreateOption Empty -DiskSizeGB <größe>
$disk = New-AzDisk -ResourceGroupName <ressourcengruppe> -DiskName <disk-name> -Disk $diskConfig
$vm = Get-AzVM -ResourceGroupName <ressourcengruppe> -Name <vm-name>
$vm = Add-AzVMDataDisk -VM $vm -Name <disk-name> -CreateOption Attach -ManagedDiskId $disk.Id -Lun <lun>
Update-AzVM -ResourceGroupName <ressourcengruppe> -VM $vm
The new disk is then connected to the virtual device but empty: Partitioning, formatting and mounting happen in the machine's operating system, not in Azure.
Enlarging
az disk update --resource-group <ressourcengruppe> --name <disk-name> --size-gb 200
Afterward you have to extend the volume in the operating system. Whether you have to stop the machine first depends on the type: Microsoft states that the size of operating system disks and shared disks can't be changed while the machine is running, and neither can that of Standard and Premium disks up to 4 TiB when you enlarge beyond 4 TiB. When in doubt, deallocate the machine first (lesson 3.3).
Protecting with a snapshot
A snapshot captures the state of a disk at a point in time:
az snapshot create --name <snapshot-name> --resource-group <ressourcengruppe> --source <disk-name>
From a snapshot, az disk create --source <snapshot-id> can create a new disk, even in another group. Backups in the exam's sense (Azure Backup) follow in lesson 5.5.