AzureIntermediate

Azure Virtual Machines: Complete Implementation Guide

Technical Writer
10 min read

TL;DR

Master Azure Virtual Machines with this comprehensive guide covering VM types, networking, storage options, scaling, and best practices for production workloads.

Azure Virtual Machines: Complete Implementation Guide

Executive Summary

Azure Virtual Machines are the lift-and-shift foundation of Azure: full control of the operating system and everything on it, in exchange for owning patching, availability design, and scaling yourself. This guide covers the decisions that shape a VM estate — series and sizing, managed disks, networking and access control, availability sets versus zones versus scale sets, backup and patching. After reading it you will be able to provision VMs that are sized from evidence rather than habit, protected by backup and just-in-time access, and placed so that a single hardware failure or maintenance event does not become an outage.

Why This Matters

VMs fail in predictable, preventable ways. A single VM with no availability design goes down when its host is serviced. An oversized instance burns budget every hour it runs; an undersized one pages at peak load. A VM with a public IP and password authentication enabled is found by scanners within hours of creation. And the estate that nobody patched or backed up discovers both facts during the same incident.

Core Concepts

Series and Sizing

Azure VM names encode the family and size. The families that matter:

  • B-series: burstable, for workloads that idle most of the time and spike occasionally — dev/test, small services. CPU credits accumulate while idle and are spent under load; sustained high CPU exhausts them and performance drops to baseline.
  • D-series: general purpose, balanced CPU-to-memory — the default choice for most application servers.
  • F-series: compute optimised, higher CPU-to-memory ratio for CPU-bound work.
  • E- and M-series: memory optimised, for databases and in-memory caches that need RAM headroom.
  • N-series: GPU-equipped, for visualisation, inference, and ML training.
  • H-series: high-performance computing with high-throughput networking.
  • Size from measurement, not from the size of the on-premises box being replaced — source systems are routinely oversized. List what a region actually offers before committing to a size in a template:

    # List available VM sizes in a region
    az vm list-sizes --location eastus
    
    # Get VM size details
    az vm list-sizes --location eastus --query "[?contains(name, 'Standard_D2s_v3')]"

    Sizes are not available in every region or zone, and quota is per family per region — verify both before a deployment depends on them.

    Creating a VM

    # Create a resource group
    az group create --name myResourceGroup --location eastus
    
    # Create a VM
    az vm create \
        --resource-group myResourceGroup \
        --name myVM \
        --image Ubuntu2204 \
        --admin-username azureuser \
        --generate-ssh-keys \
        --size Standard_D2s_v3

    The CLI creates supporting resources (VNet, public IP, NSG) when they are not specified — convenient for a first VM, and exactly what you should not rely on in production, where networking is designed explicitly and most VMs should have no public IP at all.

    Declared as infrastructure, the storage and network profile of a VM looks like this:

    {
      "vmSize": "Standard_D2s_v3",
      "storageProfile": {
        "osDisk": {
          "createOption": "FromImage",
          "managedDisk": {
            "storageAccountType": "Premium_LRS"
          }
        },
        "dataDisks": [
          {
            "diskSizeGB": 100,
            "lun": 0,
            "createOption": "Empty"
          }
        ]
      },
      "networkProfile": {
        "networkInterfaces": [
          {
            "id": "[resourceId('Microsoft.Network/networkInterfaces', 'myNIC')]"
          }
        ]
      }
    }

    Networking

    VMs live in subnets, and subnet design is security design: group VMs by trust level, and filter with network security groups. Administrative access should never be a standing open rule — use Azure Bastion or just-in-time access instead.

    # Create a virtual network
    az network vnet create \
        --resource-group myResourceGroup \
        --name myVNet \
        --address-prefix 10.0.0.0/16 \
        --subnet-name mySubnet \
        --subnet-prefix 10.0.0.0/24
    
    # Create a network security group
    az network nsg create \
        --resource-group myResourceGroup \
        --name myNSG
    
    # Add security rules
    az network nsg rule create \
        --resource-group myResourceGroup \
        --nsg-name myNSG \
        --name allow-ssh \
        --protocol tcp \
        --priority 1000 \
        --destination-port-range 22 \
        --access allow

    Enable accelerated networking on sizes that support it for latency- and throughput-sensitive workloads; it bypasses the host's virtual switch path and is free, but must be set when the NIC is created.

    Storage: Managed Disks

    Managed disks are the storage unit: you pick a type and size, Azure handles the rest. The tiers trade performance for cost — Ultra Disk for the most demanding I/O, Premium SSD for production workloads, Standard SSD for lighter duties, Standard HDD for bulk and backup. Disk performance is capped both by the disk tier and by the VM size, so a fast disk on a small VM wastes money. Caching settings matter too: for data disks hosting databases, caching can hurt more than help — follow the workload vendor's guidance rather than defaults.

    # Add a data disk
    az vm disk attach \
        --resource-group myResourceGroup \
        --vm-name myVM \
        --name myDataDisk \
        --size-gb 100 \
        --sku Premium_LRS \
        --new

    Enable Azure Disk Encryption or rely on the platform's encryption at rest, and use customer-managed keys from Key Vault when your compliance regime requires controlling the key lifecycle.

    Availability: Sets, Zones, and Scale Sets

    A single VM has no availability protection against host failure or maintenance. Three mechanisms address different problems:

    Availability sets distribute VMs across fault domains (racks) and update domains (maintenance batches) within a datacenter. They are the older mechanism, scoped to one region and one datacenter generation.

    # Create an availability set
    az vm availability-set create \
        --resource-group myResourceGroup \
        --name myAvailabilitySet \
        --platform-fault-domain-count 2 \
        --platform-update-domain-count 5

    Availability zones are physically separate datacenters within a region and are the preferred placement for new production workloads — a zone failure should not touch a well-placed pair of VMs.

    Virtual Machine Scale Sets manage a pool of identical VMs behind a load balancer, with autoscaling rules and rolling upgrades — the right shape for stateless tiers that grow and shrink:

    # Create a scale set
    az vmss create \
        --resource-group myResourceGroup \
        --name myScaleSet \
        --image Ubuntu2204 \
        --upgrade-policy-mode automatic \
        --admin-username azureuser \
        --generate-ssh-keys \
        --instance-count 3

    Monitoring and Patching

    Boot diagnostics captures the serial console and screenshots — the evidence you need when a VM will not start:

    # Enable boot diagnostics
    az vm boot-diagnostics enable \
        --name myVM \
        --resource-group myResourceGroup
    
    # Configure metrics collection
    az monitor metrics alert create \
        --name cpu-alert \
        --resource-group myResourceGroup \
        --scopes /subscriptions/mySubscriptionId/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM \
        --condition "avg Percentage CPU > 80" \
        --window-size 5m \
        --evaluation-frequency 1m

    Patching is the operational obligation VMs carry that PaaS does not. Azure Update Manager applies OS updates on a schedule with maintenance windows and reboot control; pair it with a policy that reports compliance so unpatched machines are visible rather than discovered. Enable automatic guest patching only where unplanned reboots are acceptable.

    Backup and Disaster Recovery

    Azure Backup protects VMs at the image level with application-consistent snapshots and point-in-time restore to the vault's retention:

    # Create a Recovery Services vault
    az backup vault create \
        --resource-group myResourceGroup \
        --name myVault \
        --location eastus
    
    # Enable backup
    az backup protection enable-for-vm \
        --resource-group myResourceGroup \
        --vault-name myVault \
        --vm myVM \
        --policy-name DefaultPolicy

    Backup is not disaster recovery: restoring into the same region does nothing for a regional failure. Azure Site Recovery replicates VMs to a secondary region for that case. Decide which workloads need which, and test restores — a backup that has never been restored is a hypothesis.

    Cost Controls

    The levers that actually move a VM bill: right-sizing from utilisation data, reserved instances or savings plans for steady workloads, spot VMs for interruptible work, and shutting down what is not used.

    # Convert to spot instance
    az vm update \
        --resource-group myResourceGroup \
        --name myVM \
        --priority Spot \
        --max-price -1
    
    # Enable auto-shutdown
    az vm auto-shutdown \
        --resource-group myResourceGroup \
        --name myVM \
        --time 1730

    Note that converting a running VM to spot changes its eviction contract — only do it to workloads designed to be interrupted. Tag everything with owner and environment so cost reports assign spend to a team, not a mystery.

    Decision Framework

    SituationRecommendation
    Lift-and-shift of an existing server workloadAzure VMs, sized from source utilisation data
    Stateless web or API tier with variable loadVM Scale Sets behind a load balancer, or evaluate App Service/Container Apps first
    Production workload needing resilience within a regionAvailability zones; availability set only where zones are unavailable
    Regional failure must be survivableSite Recovery replication to a secondary region, with a tested failover runbook
    Interruptible batch or CI workSpot VMs with eviction handling in the workload
    Steady 24x7 workloadReserved capacity or a savings plan once the size is proven stable

    Implementation Checklist

  • [ ] Size chosen from measured utilisation; quota and zone availability verified in the target region
  • [ ] No public IP by default; administration via Bastion or just-in-time access; password authentication disabled in favour of keys or Entra login
  • [ ] Managed disks tier matched to workload I/O, and VM size checked against disk performance caps
  • [ ] Availability design explicit: zones, availability set, or a documented decision to accept single-VM risk
  • [ ] Azure Backup enabled with retention matched to recovery requirements; a restore tested
  • [ ] Update Manager schedule and maintenance window assigned; patch compliance reported
  • [ ] Boot diagnostics and metric alerts enabled; logs routed to Log Analytics
  • [ ] Managed identity assigned for Azure API access; no stored credentials on the VM
  • [ ] Tags for owner, environment, and cost centre applied at creation
  • Trade-offs

    VMs maximise control and compatibility — any legacy agent, kernel requirement, or odd licence term can usually be accommodated — and in exchange you own the entire operational stack: patching, hardening, availability, scaling, backup. Per-second billing makes VMs look cheap at creation and expensive at estate scale, where idle and oversized machines dominate. Scale sets recover some elasticity, but stateful workloads on VMs remain pets that must be fed individually, however good the automation around them.

    When Not to Use

  • Azure VMs are the wrong choice for a standard web application or API that App Service or Container Apps can host — you would be buying patching and OS management you do not need.
  • A single VM is the wrong choice for anything with an availability commitment; use zones or a scale set, or state the risk in writing.
  • Spot VMs are the wrong choice for stateful or user-facing workloads that cannot tolerate eviction.
  • Availability sets are the wrong choice for new deployments in regions with availability zones; zones provide stronger separation.
  • Conclusion

    Azure VMs reward the teams that treat them as managed assets rather than rented servers: sized from evidence, placed across zones, patched and backed up on a schedule, and reached through Bastion or just-in-time access instead of open ports. Apply those defaults and a VM estate is dependable. Skip them, and the platform's flexibility becomes a list of ways to be unavailable, unpatched, and over budget at the same time.

    Why This Matters

    Understanding the business and technical context helps you make informed decisions rather than blindly following patterns.

    Trade-offs to Consider

    Every architectural decision involves trade-offs. Consider your specific requirements, team expertise, and scale when evaluating options.

    When NOT to Use This

    Knowing when a solution doesn't apply is as valuable as knowing when it does. Consider alternatives for your specific situation.

    Decision Framework

    Use this framework to evaluate whether this approach is right for your use case based on your specific constraints and requirements.

    Share this articleShare on XShare on LinkedIn

    Keep the decision frameworks coming

    One practical architecture guide a week — patterns, trade-offs, and when not to use them. No spam, unsubscribe anytime.