Create and configure virtual machines
Build VMs, encrypt and size them, manage disks, move them, and design for availability with zones, availability sets and scale sets.
- 22 min
- 7 concepts
- Try it yourself
- 5-question check
Learn
An Azure VM is infrastructure as a service: Microsoft runs the hardware and hypervisor, and you look after the operating system, patches and apps. A VM is made of several resources: the VM itself, an OS disk, optional data disks, a network interface, often a public IP, and a virtual network.
The exam focuses on sizing, disks, encryption, moving VMs and, above all, which availability option to use for which failure.
- 1
Create a virtual machine
When you create a VM you choose the region, availability option, security type (Trusted launch is the default for supported Gen2 images), image, size, administrator account, inbound ports, disks and networking.
Avoid opening RDP or SSH to the internet. Use Azure Bastion or just-in-time access instead.
Remember: Several resources are created with a VM. Deleting the VM doesn't always delete its disks, NIC and public IP unless you chose to.
- 2
Configure Azure Disk Encryption
Managed disks are always encrypted at rest with server-side encryption. Azure Disk Encryption adds encryption inside the VM with BitLocker (Windows) or DM-Crypt (Linux), with keys in Key Vault.
Microsoft now recommends encryption at host for new VMs, which encrypts temporary disks and caches too, and has announced that Azure Disk Encryption will retire in 2028.
Remember: Key Vault used by Azure Disk Encryption must be in the same region and subscription as the VM.
- 3
Move a virtual machine to another resource group, subscription, or region
Moving a VM to another resource group or subscription uses the Move operation and must include dependent resources such as disks and NICs. The resource ID changes; the VM's settings don't.
Moving to another region is different: use Azure Resource Mover, or Azure Site Recovery, which replicate and recreate the VM.
Remember: Resource group or subscription: Move. Region: Resource Mover.
- 4
Manage virtual machine sizes
Sizes are grouped into families such as general purpose (D), memory optimised (E), compute optimised (F) and burstable (B). A name like Standard_D4s_v5 means D family, 4 vCPUs, s for premium storage support, version 5.
You can resize a running VM, which restarts it. If the size you want isn't listed, deallocate the VM so Azure can place it on hardware that supports that size.
Remember: Resizing restarts the VM. Plan it in a maintenance window.
- 5
Manage virtual machine disks
Disk types are Ultra Disk, Premium SSD v2, Premium SSD, Standard SSD and Standard HDD. Each VM has an OS disk and a temporary disk; data disks hold your data.
You can add data disks, increase a disk's size (you can't shrink it), change a disk's performance tier, and take snapshots. The temporary disk is lost when the VM is deallocated or moved, so never keep data on it.
Remember: Disks can be made bigger but never smaller.
- 6
Deploy virtual machines to availability zones and availability sets
An availability set spreads VMs across fault domains (separate power and network racks) and update domains (rebooted at different times for maintenance) within one datacentre. Two or more VMs in a set get a 99.95% SLA.
Availability zones are physically separate datacentres in a region. Spreading two or more VMs across zones gives a 99.99% SLA and survives a whole datacentre failing.
Remember: A VM can be in an availability set or a zone, not both.
- 7
Deploy and configure an Azure Virtual Machine Scale Sets
A scale set manages a group of load-balanced VMs and can add or remove instances automatically with autoscale rules based on metrics such as CPU, or on a schedule. You pay only for the instances, not the scale set.
Flexible orchestration is the recommended mode and can spread instances across zones and fault domains. Uniform mode uses identical instances from one model.
Remember: Scale out adds instances; scale up makes each instance bigger.
Availability options
- One datacentre
- Fault domains + update domains
- Protects against rack and host failures
- 99.95% with two or more VMs
- Separate datacentres in one region
- Independent power, cooling, network
- Protects against a datacentre failing
- 99.99% with two or more VMs
- Group of identical VMs
- Autoscale on metrics or schedule
- Can span zones
- Pay only for the instances
Try it
Pick a deployment and see which failures it survives.
This interactive part needs JavaScript.
In the portal
- Create a VMAzure portal: Virtual machines > Create > Azure virtual machine
- Resize a VMAzure portal: Virtual machines > your VM > Availability + scale > Size
- Add a data diskAzure portal: Virtual machines > your VM > Settings > Disks > Create and attach a new disk
- Move to another regionAzure portal: Azure Resource Mover > Move across regions
Key terms
Click a card to see the definition.
Check your understanding
5 questions. Score 80% or more and these skills are marked as confident in your AZ-104 study plan.
What does an availability set protect against?
Fault and update domains are within one datacentre. Zones protect against a datacentre failing.
What SLA do two or more VMs across availability zones get?
Zones give 99.99%. An availability set gives 99.95%.
The VM size you need isn't listed when resizing. What should you do?
Deallocating lets Azure place the VM on hardware that supports the size.
How do you move a VM to another region?
Region moves recreate the VM in the new region.
Can you shrink a managed disk?
Managed disks can only be expanded.
Sources
- Microsoft Learn: Availability options for Azure Virtual Machines
- Microsoft Learn: Overview of managed disk encryption options
- Microsoft Learn: Azure managed disk types
- Microsoft Learn: Sizes for virtual machines in Azure
- Microsoft Learn: Orchestration modes for Virtual Machine Scale Sets
- Microsoft Learn: What is Azure Resource Mover?
Facts in this lesson are from Microsoft Learn. This site isn't affiliated with Microsoft.