Skip to content

Azure Virtual Machines

Overview

Azure Virtual Machines (VMs) are Infrastructure-as-a-Service (IaaS) offerings that provide on-demand, scalable compute in the cloud.

They behave just like traditional physical servers, allowing you to run Windows, Linux, or custom OS images in isolated environments with full administrative control.

Key Features

  • Full OS-level access (Remote Desktop, SSH)
  • Host custom applications, databases, or legacy systems
  • Choose CPU, memory, storage, and networking configurations
  • Supports automation via ARM templates, Bicep, Terraform, Azure CLI
  • Scale vertically (more power) or horizontally (load-balanced VM scale sets)
  • Integration with backup, monitoring, update management, and more

Advantages

  • Full control – Install and configure anything at the OS level
  • Supports any workload – Web servers, databases, app servers, file servers
  • Customizability – Pick OS, disk type, size, networking, and extensions
  • Lift-and-shift – Ideal for migrating on-prem workloads
  • Isolation and security – Each VM is logically isolated

Drawbacks / Considerations

  • Management overhead – You must patch, update, monitor, and secure the OS yourself
  • Slower to deploy than PaaS services like App Service or Functions
  • Costs more if always running compared to serverless or container options
  • Cold start latency – Provisioning a new VM takes time
  • Scaling is manual or complex – Needs autoscaling setup or VM Scale Sets

Conceptual Use Case

Use Azure VMs when:

  • You need full control over the OS and runtime
  • You're running stateful, legacy, or custom applications
  • You want to run third-party software not supported on PaaS (e.g., custom DB engines)
  • You need to replicate on-prem infrastructure during migration
  • You're hosting domain controllers, SQL Server, Docker hosts, etc.

Example: Provisioning a Windows VM (Azure CLI)

az vm create \
  --resource-group myResourceGroup \
  --name myVM \
  --image Win2022Datacenter \
  --admin-username stuart \
  --admin-password "MyStrongPassword123" \
  --size Standard_D2s_v3

This creates a Windows Server 2022 VM with a public IP, disk, and basic networking.

VM Sizes and Types

Azure offers various VM families optimized for different workloads:

VM Family Purpose
B-series Budget burstable workloads
D-series General purpose compute
E-series Memory-optimized
F-series Compute-optimized
M-series Massive memory (SAP, big data)
N-series GPU-intensive (AI, ML, rendering)
H-series High performance compute (HPC)

Storage Options

  • OS Disk – Managed disk used to boot the VM
  • Data Disks – Add extra managed disks (Standard HDD/SSD or Premium SSD)
  • Temporary Disk – Ephemeral storage, wiped on restart
  • Azure Files / Blob Storage – Mount additional file or object storage

Security Features

  • NSGs (Network Security Groups) – Control inbound/outbound traffic
  • Azure Defender for Servers – Threat detection and hardening
  • Azure Bastion – Secure RDP/SSH access without public IP
  • Disk Encryption – Using Azure Key Vault and BitLocker / DM-Crypt
  • Just-in-Time (JIT) VM Access – Temporarily open ports when needed

Management Tools

  • Azure Portal – UI-based VM management
  • Azure CLI / PowerShell – Scripting and automation
  • ARM / Bicep / Terraform – Infrastructure as Code
  • Azure Monitor + Log Analytics – Alerts, performance tracking
  • Azure Backup + Site Recovery – Business continuity solutions

Scaling Options

Scaling Type Description
Manual Resize VM or duplicate manually
Autoscaling Use VM Scale Sets with load balancing and auto rules
Availability Sets Group VMs across fault and update domains
Availability Zones Distribute VMs across separate data centers

Pricing and Billing

  • Pay-as-you-go or reserved instances (1/3 years)
  • Charged based on:
    • VM size
    • OS (Windows typically more expensive than Linux)
    • Disk type and size
    • Networking (egress data)
  • You can shut down VMs to save cost, but disks still incur charges

Use Azure Pricing Calculator to estimate costs.

Further Reading

Summary

Use Case Recommendation
Full control over OS Azure VM
Hosting legacy applications Azure VM
Quick, scalable web/API hosting Consider App Service or Container Apps
Stateless workloads Use Functions or AKS
Lift-and-shift from on-prem Azure VM