Azure Virtual Machines

Azure Virtual Machines (VMs) are one of the most fundamental and widely used services in Microsoft Azure. A virtual machine is a software-based computer that runs inside a physical server in Azure's data center. It behaves exactly like a real computer — it has an operating system, CPU, memory, storage, and a network connection. The only difference is that everything runs virtually on Microsoft's hardware.

What is a Virtual Machine?

Imagine a powerful physical server sitting in a data center. That single server is so powerful that it can run 10 to 20 virtual computers inside it simultaneously, each completely isolated from the others. Each of these virtual computers is called a virtual machine.

Azure Virtual Machines fall under the IaaS (Infrastructure as a Service) category — Microsoft manages the physical hardware, but the operating system, applications, and configuration are the user's responsibility.

When to Use Azure VMs

  • Running a Windows or Linux server in the cloud
  • Lifting and shifting an existing on-premises application to Azure without any code changes
  • Hosting websites, APIs, or databases on a server with full control
  • Running development and test environments that need to be created and destroyed quickly
  • High-performance computing (HPC) tasks like video rendering or scientific simulations

VM Components

When an Azure Virtual Machine is created, it involves multiple related resources that work together:

Diagram – Virtual Machine Components

  ┌──────────────────────────────────────────────────┐
  │                Azure Virtual Machine             │
  │                                                  │
  │  ┌──────────┐  ┌──────────┐  ┌────────────────┐  │
  │  │  vCPU    │  │   RAM    │  │  OS Disk (VHD) │  │
  │  │ (Compute)│  │(Memory)  │  │  (Managed Disk)│  │
  │  └──────────┘  └──────────┘  └────────────────┘  │
  │                                                  │
  │  ┌───────────────────┐ ┌────────────────────────┐│
  │  │  Network Interface│ │   Data Disk (optional) ││
  │  │  Card (NIC)       │ │   (Managed Disk)       ││
  │  └───────────────────┘ └────────────────────────┘│
  └──────────────────────────────────────────────────┘
         │
         ▼
  ┌──────────────────┐
  │  Virtual Network │ ←── Public IP Address
  │  (VNet / Subnet) │ ←── Network Security Group (NSG)
  └──────────────────┘
ComponentPurpose
vCPUVirtual processor — handles computation
RAMMemory for running applications
OS DiskDisk that holds the operating system (Windows or Linux)
Data DiskAdditional storage disk for application data
Network Interface Card (NIC)Connects the VM to a virtual network
Public IP AddressAllows the VM to be accessed from the internet
Network Security Group (NSG)Firewall rules that control inbound and outbound traffic
Virtual Network (VNet)Isolated private network that the VM connects to

Azure VM Sizes and Series

Azure offers hundreds of VM sizes organized into series, each optimized for a specific type of workload.

SeriesTypeBest For
B-SeriesBurstableLow-cost VMs for workloads that are idle most of the time but occasionally spike (e.g., dev/test)
D-SeriesGeneral PurposeBalanced CPU and memory for most production applications
E-SeriesMemory OptimizedHigh memory for databases, SAP, in-memory caching
F-SeriesCompute OptimizedHigh CPU ratio for batch processing, game servers, analytics
N-SeriesGPU EnabledMachine learning training, video rendering, graphics-intensive applications
L-SeriesStorage OptimizedHigh disk throughput for NoSQL databases, data warehouses
M-SeriesMemory ExtremeVery large SAP HANA workloads, up to 12 TB RAM

VM Size Naming Convention

  Standard_D4s_v5

  Standard  = Tier (Standard or Basic)
  D         = Series (D = General Purpose)
  4         = 4 vCPUs
  s         = supports Premium SSD storage
  v5        = Version 5 (hardware generation)

Creating a Virtual Machine – Step-by-Step

  1. Open Azure Portal → Virtual Machines → Create
  2. Choose a Subscription and Resource Group
  3. Enter a VM name, select a Region
  4. Choose Availability Zone (for high availability)
  5. Select an Image (Windows Server 2022, Ubuntu 22.04, etc.)
  6. Choose a VM size (e.g., Standard_B2s for testing)
  7. Set Administrator credentials (username and password, or SSH key for Linux)
  8. Configure Inbound port rules (e.g., allow RDP on port 3389 for Windows, SSH on port 22 for Linux)
  9. Configure Disk (Standard HDD, Standard SSD, or Premium SSD)
  10. Configure Networking (Virtual Network, Subnet, Public IP)
  11. Review and click Create

VM Disk Types

Disk TypeSpeedCostBest For
Standard HDDLowestCheapestDev/test, low-priority backups
Standard SSDMediumMediumWeb servers, lightly used apps
Premium SSDHighHigherProduction databases, enterprise apps
Ultra DiskExtremeHighestSAP HANA, high-frequency trading, I/O intensive workloads

VM High Availability Options

Availability Sets

An availability set groups VMs so that at least one VM remains running during planned maintenance or hardware failure. It uses two concepts:

  • Fault Domains (FD): Groups of physical hardware that share the same power and network switch. VMs are spread across different fault domains so a single hardware failure does not take all VMs offline.
  • Update Domains (UD): Groups of VMs that can be restarted together during planned Azure maintenance. Azure restarts only one update domain at a time.

Availability Zones

Deploying VMs across multiple availability zones (physically separate data centers in the same region) gives the highest protection against outages. If an entire data center fails, the VMs in other zones continue running.

VM Scale Sets

Azure Virtual Machine Scale Sets (VMSS) allow automatic scaling of identical VMs based on demand. When traffic increases, new VM instances are added automatically. When traffic drops, extra instances are removed to save costs.

Connecting to a Virtual Machine

OSProtocolPortTool
WindowsRDP (Remote Desktop Protocol)3389Remote Desktop Connection (built into Windows)
LinuxSSH (Secure Shell)22Terminal, PuTTY, or Azure Cloud Shell
BothAzure Bastion443 (HTTPS)Browser-based, no public IP needed — most secure option

VM Pricing and Cost Management

  • Compute cost: Charged per second the VM is running. Stopping (deallocating) the VM stops the compute charge.
  • Disk cost: Charged even when the VM is stopped. The managed disk persists and incurs cost.
  • Networking cost: Outbound data transferred from Azure incurs a charge. Inbound traffic is free.
  • Reserved VM Instances: Commit to 1 or 3 years and save up to 72% on compute costs.
  • Spot VMs: Use unused Azure capacity at up to 90% discount — suitable for batch jobs that can tolerate interruptions.
  • Azure Hybrid Benefit: Bring existing Windows Server or SQL Server licenses to Azure and save up to 49%.

Key Takeaways

  • Azure Virtual Machines are IaaS resources — Microsoft manages the hardware, and the user manages everything from the OS up.
  • VM components include vCPU, RAM, OS disk, data disk, NIC, public IP, NSG, and VNet.
  • VM sizes are organized by series: B (burstable), D (general purpose), E (memory optimized), F (compute optimized), N (GPU), and more.
  • High availability is achieved using availability sets, availability zones, and VM scale sets.
  • Azure Bastion provides secure browser-based connectivity to VMs without exposing them to the internet via RDP or SSH ports.
  • Stopping (deallocating) a VM stops compute charges but disk charges continue until the disk is deleted.

Leave a Comment