Lesson 09 — Virtual Machines: Configuration, Sizing & Availability
Compute Is the Heart of the AZ-104 Exam
At 20–25% exam weight, the compute domain is the largest single domain in AZ-104. Virtual machines are where most Azure administrators spend the majority of their day: provisioning, resizing, configuring disks, managing availability, deploying extensions, and troubleshooting. The exam tests both theoretical knowledge (which SLA does an availability zone give you?) and operational judgment (when should you use a spot VM? what disk type for a database?)
This lesson covers every major VM concept you need: VM families, the disk ecosystem, the four availability layers, proximity placement groups, spot VMs, extensions, images, and hybrid licensing. Master this and you have locked in over a fifth of your exam score before the next domain.
VM Families and the Naming Convention
Azure has dozens of VM series, each optimised for a specific workload class. The AZ-104 exam does not require memorising every series, but you must know the major families and be able to decode the VM size naming convention.
| Family | Optimised For | Example Sizes | Typical Use Cases |
|---|---|---|---|
| D-series | General purpose (balanced CPU/RAM) | Standard_D4s_v5, Standard_D8as_v5 | Web servers, app servers, small databases, dev/test |
| E-series | Memory optimised (high RAM:vCPU ratio) | Standard_E8s_v5, Standard_E64s_v5 | In-memory databases (SAP HANA, Redis), large caches |
| F-series | Compute optimised (high vCPU:RAM ratio) | Standard_F4s_v2, Standard_F72s_v2 | Batch processing, web frontends, game servers |
| L-series | Storage optimised (high local NVMe throughput) | Standard_L8s_v3, Standard_L80s_v3 | NoSQL databases, Elasticsearch, data warehousing |
| N-series | GPU compute and visualisation | Standard_NC6s_v3, Standard_NV12s_v3 | AI/ML training (NC), remote visualisation and rendering (NV) |
| B-series | Burstable (CPU credit model) | Standard_B2s, Standard_B4ms | Dev/test, low-traffic web servers, small CI/CD agents |
Decoding the VM Size Name
Understanding the naming convention is a practical skill and sometimes tested directly. The format is:
Additional letter modifiers you may encounter: a = AMD processor, d = local temp disk included, i = isolated (dedicated physical host), l = low memory variant, m = memory optimised variant within the family.
VM Creation Components
Deploying a VM is not a single-resource operation. A VM deployment touches multiple Azure resources, each with its own lifecycle and configuration options:
- OS Disk: Managed disk containing the operating system. Sourced from a marketplace image, a custom image, or an uploaded VHD. Type must be selected at creation (Standard HDD/SSD, Premium SSD v1/v2, Ultra).
- Data Disks: Additional managed disks attached for application data. A VM can have multiple data disks (limit depends on VM size). Each has independently configurable disk type and caching.
- NIC (Network Interface Card): Every VM has at least one NIC with a private IP in a VNet subnet. A public IP can be attached. NSGs can be associated at NIC or subnet level.
- Admin Credentials: Windows VMs use username/password. Linux VMs should always use SSH key pairs — password authentication on Linux should be disabled.
- Availability Configuration: Availability set, availability zone, or none. Must be configured at VM creation time — you cannot move a deployed VM into an availability set or change its zone later.
- Extensions: Agents and scripts installed post-deployment for monitoring, encryption, configuration management.
OS Image Types
Azure VMs are deployed from images. Understanding image types is important for VM fleet management at scale.
| Image Type | Description | Use Case |
|---|---|---|
| Marketplace image | Pre-built images from Microsoft and third-party publishers (Windows Server, Ubuntu, RHEL, SQL Server, etc.). Always up to date. | Standard deployments where the base OS is sufficient |
| Custom image (generalised) | Created by Sysprep-ing (Windows) or running waagent -deprovision (Linux) on a VM, then capturing it. All machine-specific data removed. | Golden images with pre-installed software, custom configuration. Safe to deploy multiple VMs from. |
| Custom image (specialised) | A snapshot of a VM without Sysprep/deprovision — retains machine identity, hostname, SIDs. | Disaster recovery restore, one-off migrations. Not safe for multi-VM deployment. |
| Azure Compute Gallery image | Versioned images stored in a gallery (formerly Shared Image Gallery). Can replicate across regions and share across subscriptions. | Enterprise image management for large VM fleets |
Azure Compute Gallery
The Azure Compute Gallery (formerly Shared Image Gallery) provides enterprise-grade image management:
- Image definitions: Metadata container specifying OS type (Windows/Linux), publisher, offer, SKU, and generation (Gen1/Gen2).
- Image versions: Actual image artifacts with version numbers (e.g. 1.0.0, 1.1.0). Each version can be replicated to multiple Azure regions for performance.
- RBAC sharing: Share images with specific subscriptions, tenants, or make them publicly available.
- Regional replication: Azure replicates image versions to chosen regions automatically, reducing deployment time for VM scale sets and large fleets.
Managed Disks
Always use managed disks. Unmanaged disks (page blobs stored in a customer-managed storage account) are a legacy concept — you have to manage the storage accounts yourself, availability set placement is limited, and Azure Backup integration is poor. Managed disks are standalone Azure resources with their own resource ID, independent lifecycle, and first-class Azure feature support.
Disk Types Compared
| Disk Type | Media | IOPS (max) | Throughput | Latency | Best For |
|---|---|---|---|---|---|
| Standard HDD | HDD (magnetic) | 500 IOPS/disk | 60 MB/s | High (ms) | Dev/test, infrequently accessed data, backups |
| Standard SSD | SSD | 6,000 IOPS/disk | 750 MB/s | Medium | Production workloads with moderate IOPS, web servers |
| Premium SSD v1 | SSD (NVMe) | Up to 20,000 IOPS/disk (P50) | Up to 900 MB/s | Low (single-digit ms) | Production databases, enterprise apps; IOPS/throughput tied to disk size tier |
| Premium SSD v2 | SSD (NVMe) | Up to 80,000 IOPS/disk | Up to 1,200 MB/s | Sub-ms | High-performance databases; IOPS/throughput configurable independently of size |
| Ultra Disk | SSD (NVMe) | Up to 160,000 IOPS/disk | Up to 4,000 MB/s | Sub-ms (<1 ms) | Most demanding I/O: SQL Server, SAP HANA, Oracle. Must be in same AZ as VM. |
Disk Caching
Each managed disk has a configurable caching mode, which determines how the host server's RAM and CPU are used to buffer I/O before it reaches the actual disk:
| Cache Mode | Behaviour | Default On | When to Use |
|---|---|---|---|
| None | I/O goes directly to disk. No host cache involved. | Data disks (Ultra, Premium SSD v2) | Write-heavy workloads; databases where application-level write-ahead logging already handles durability |
| ReadOnly | Reads are served from host cache (RAM). Writes go directly to disk. Cache is populated on read. | — | Read-heavy data disks: OS images, reference data, read-only databases |
| ReadWrite | Both reads and writes are buffered in host cache before being committed to disk. | OS disk | Only the OS disk. Never use on database data disks. |
None or ReadOnly on data disks running databases. This is a critical operations mistake that appears regularly on the exam and in real-world incidents.
Availability: Four Levels of Protection
Azure's availability model is layered. The level of protection you need — and the SLA you can claim — depends on which option you use. These concepts are tested heavily on AZ-104 because the exam loves questions that distinguish between the options and their specific SLA percentages.
Fault Domains and Update Domains
These are the building blocks of Availability Sets:
- Fault Domain (FD): A physical rack in a datacenter that shares a power source and network switch. VMs in different fault domains will not be simultaneously affected by a rack power failure or network switch failure. Availability sets use 2–3 fault domains.
- Update Domain (UD): A logical grouping of VMs that Azure reboots together during planned maintenance. Azure guarantees it will only reboot one update domain at a time. Default: 5 UDs per availability set. Azure waits 30 minutes between UDs during maintenance.
Availability Comparison
| Option | Protects Against | Does NOT Protect Against | SLA | Key Constraint |
|---|---|---|---|---|
| No availability config | Nothing beyond Azure's internal host maintenance | Host failure, rack failure, datacenter failure | 99.9% (single VM with Premium SSD) | — |
| Availability Set | Rack power/network failure (FDs); planned maintenance reboots (UDs) | Datacenter failure, regional failure | 99.95% | All VMs in same datacenter. Must be set at VM creation. |
| Availability Zone | Datacenter failure (zone failure); rack and power failures within zone | Regional failure (both regions of a region pair) | 99.99% | VMs in different physical datacenters in same region. Must be set at VM creation. |
| Azure Site Recovery (cross-region) | Regional failure | — | Based on RPO/RTO targets (not a VM SLA) | Separate service; DR, not HA |
Proximity Placement Groups
Proximity Placement Groups (PPGs) instruct Azure to co-locate VMs as physically close as possible — in the same datacenter, on the same compute cluster. This minimises network latency between VMs, which is critical for tightly coupled workloads like HPC clusters or multi-tier apps with microsecond latency requirements.
The trade-off: PPGs reduce fault tolerance. If the underlying host cluster or datacenter experiences a failure, all VMs in the PPG may be affected simultaneously. PPGs and full availability zone isolation are inherently in tension — you must choose based on your workload's latency vs. resilience requirements.
Azure Spot VMs
Spot VMs allow you to use Azure's unused compute capacity at up to 90% discount compared to pay-as-you-go pricing. The catch: Azure can evict a spot VM at any time — with only 30 seconds notice — when Azure needs the capacity back for standard-priority workloads.
| Aspect | Details |
|---|---|
| Eviction policy | Stop/Deallocate (VM is stopped and deallocated but disk preserved) or Delete (VM and disk deleted on eviction) |
| Eviction notice | 30-second notice via Azure Metadata Service or Azure Scheduled Events |
| Max price | Optionally set a maximum price you're willing to pay per hour; eviction occurs if spot price exceeds max |
| Suitable workloads | Batch processing, data analytics, CI/CD agents, development environments, stateless web tiers with graceful shutdown |
| Unsuitable workloads | Databases, stateful apps, production user-facing services, anything requiring guaranteed availability |
VM Extensions
VM extensions are small agent packages that run inside the VM to provide post-deployment automation and integration with Azure services. They run under the Azure VM Guest Agent, which must be running on the VM.
| Extension | Purpose | Key Points |
|---|---|---|
| Custom Script Extension (CSE) | Runs a shell script (Windows: PowerShell/CMD; Linux: bash) on the VM at deployment or on-demand | One-shot execution — not idempotent by design. Re-running requires updating the script version. Download script from Azure Storage, GitHub, or embed in extension JSON. |
| Azure Monitor Agent (AMA) | Collects performance metrics, event logs, syslog from the VM and sends to Log Analytics Workspace | Replaces legacy Log Analytics Agent (MMA/OMS) and Azure Diagnostics extension. Required for VM Insights, Change Tracking, Update Manager in 2026. Uses Data Collection Rules (DCRs) for fine-grained data collection configuration. |
| Azure Disk Encryption (ADE) | Encrypts OS and data disks at the volume level | Windows: BitLocker; Linux: dm-crypt. Encryption keys stored in Azure Key Vault. Requires Key Vault to be in same subscription. Distinct from SSE (Server-Side Encryption) which is Azure-managed and always on. |
| PowerShell DSC | PowerShell Desired State Configuration for declarative Windows configuration management | Good for enforcing OS configuration state (installed roles, services, registry keys). Idempotent. Can integrate with Azure Automation State Configuration. |
| VM Access Extension | Reset admin passwords, SSH keys, or network configuration on a locked-out VM | Emergency use. Allows recovery without console access when SSH/RDP is broken. |
VM Snapshots vs. Azure Backup
There are two ways to create point-in-time recovery points for a VM's disks. Understanding when to use each is important for both the exam and production operations.
| Method | Mechanism | Application Consistent? | Use Case | Cost |
|---|---|---|---|---|
| Managed Disk Snapshot | Full or incremental copy of a single managed disk, stored in Azure | Crash-consistent only (unless VM is quiesced) | Pre-change safety copy before risky disk operations; ad-hoc disk restore | Storage cost for snapshot data (incremental after first) |
| Azure Backup for VMs | VSS-coordinated (Windows) or fsfreeze (Linux) snapshot of all VM disks via Recovery Services Vault | Yes — application-consistent for most workloads | Scheduled, policy-driven backup with long-term retention; BCDR | Vault storage + backup instance fee |
Azure Hybrid Benefit
Azure Hybrid Benefit (AHB) allows you to apply existing on-premises Windows Server licenses with Software Assurance to Azure VMs — paying Linux pricing for Windows VMs. The savings can reach up to 49% on Windows VM compute costs.
AHB can also be applied to SQL Server licences (avoiding SQL license charges on Azure VMs) and to Azure Stack HCI licensing. For Windows VMs, AHB is toggled at VM creation time or applied to existing VMs without downtime — it is purely a billing flag.
Resizing VMs
VM resize behaviour depends on whether the target size is available on the same physical host cluster as the current VM:
- Same family, nearby sizes: Azure can often resize without deallocating the VM — brief reboot but no full deallocation. Example: D4s_v5 → D8s_v5.
- Cross-family resize: Requires VM deallocation (the VM is stopped and its compute allocation released). The VM is reassigned to a different host cluster that supports the target family. This causes downtime. Example: D4s_v5 → E8s_v5.
Check Your Understanding
Click any option to see immediate feedback. Answers represent correct behaviour in a real Azure environment.
1. You are deploying a two-VM application tier and need to achieve a 99.99% SLA for the tier's uptime. What deployment configuration achieves this?
2. You need a 2 TiB data disk that supports 50,000 IOPS and 600 MB/s throughput, configurable independently of the disk size. Which Azure managed disk type meets this requirement?
3. A database team configures ReadWrite disk caching on the data disks of their SQL Server VM for maximum write performance. What risk have they introduced?
4. You have two VMs in an Availability Set with 2 Fault Domains. The rack hosting Fault Domain 0 loses power. What is the expected outcome?
5. A developer wants to use Azure Spot VMs for a production API that handles user-facing requests. You need to explain why this is inappropriate. What is the primary technical risk?
6. An architect asks which VM monitoring agent you should deploy on new Azure VMs in 2026 for metric collection, log forwarding to a Log Analytics workspace, and VM Insights. What is the correct answer?
Follow the linked articles on managed disk types, availability options, and VM extensions. The managed disks overview and the availability options comparison page are essential reading before your exam.
This lesson covered VM fundamentals at depth. Explore further with any of these:
- Walk me through creating a generalised Windows Server image using Sysprep and storing it in an Azure Compute Gallery with regional replication.
- How do I configure Azure Disk Encryption (ADE) on an existing VM — what Key Vault settings are required?
- Explain the difference between Azure Disk Encryption (ADE), Server-Side Encryption (SSE), and host-based encryption — when would you use each?
- How do Proximity Placement Groups interact with Availability Zones — can you use both simultaneously?