AzureAzure Virtual MachinesCompute

azurerm_windows_virtual_machine cost estimation

A single Windows VM. Bills per hour for the size — including a Windows license surcharge — plus a managed OS disk. A Standard_D2s_v5 runs ~$137/month before the disk.

An azurerm_windows_virtual_machine is the modern single-VM resource for Windows workloads. Its cost has the same two parts as a Linux VM — compute plus a managed OS disk — but the compute rate is meaningfully higher because it bundles a per-core Windows Server license into the hourly price.

A Standard_D2s_v5 (2 vCPU, 8 GiB) on Windows is about $0.188/hour (~$137/month run 24/7), versus ~$0.096/hour for the identical Linux hardware. That ~2x gap is almost entirely the Windows license. It's the single biggest reason to either run Linux where you can or apply Azure Hybrid Benefit to bring your own license.

The OS disk bills the same way as on Linux — a managed disk billed per provisioned tier (a 128 GB Premium SSD P10 is ~$19.71/month), whether the VM is running or stopped-deallocated. Compute stops billing when the VM is deallocated; the disk keeps billing.

c3x prices the compute from the size attribute (Windows rate) and the OS disk from os_disk_storage_account_type and os_disk_disk_size_gb. Azure Hybrid Benefit, reservations, and Spot are modelled separately.

Terraform example

A minimal but realistic configuration that C3X can estimate.

resource "azurerm_windows_virtual_machine" "app" {
  name                = "app-vm"
  resource_group_name = azurerm_resource_group.main.name
  location            = "eastus"
  size                = "Standard_D2s_v5"
  admin_username      = "azureadmin"
  admin_password      = var.admin_password

  network_interface_ids = [azurerm_network_interface.app.id]

  os_disk {
    caching              = "ReadWrite"
    storage_account_type = "Premium_LRS"
    disk_size_gb         = 128
  }

  source_image_reference {
    publisher = "MicrosoftWindowsServer"
    offer     = "WindowsServer"
    sku       = "2022-datacenter-azure-edition"
    version   = "latest"
  }
}

Pricing dimensions

What you actually pay for when you provision azurerm_windows_virtual_machine.

DimensionUnitWhat's being charged
Compute (Windows, by size)per hourSet by the size attribute and includes the Windows Server license surcharge. Billed per second while running; stops when deallocated.
$0.188/hour ≈ $137.24/month for Standard_D2s_v5 (Windows, eastus)
OS managed diskper disk-monthFlat per-tier charge sized to the disk, not bytes used. Bills whether the VM runs or not.
$19.71/month for a 128 GB Premium SSD (P10)
Data disks (if attached)per disk-monthEach azurerm_managed_disk attached to the VM bills on its own tier. Estimated as separate resources.

Sample C3X output

A Standard_D2s_v5 Windows VM running 24/7 (compute only; add the OS disk):

azurerm_windows_virtual_machine.app
└─ Virtual machine (Standard_D2s_v5, Windows)   730 hours   $137.24
                                                Monthly     $137.24

Optimization tips

Common ways to reduce azurerm_windows_virtual_machine cost without changing the workload.

Apply Azure Hybrid Benefit

Up to ~40% of compute

If you own Windows Server licenses with Software Assurance, Azure Hybrid Benefit removes the license portion of the hourly rate — dropping a Windows VM close to the Linux price. The biggest single Windows-VM saving.

Run Linux where the workload allows

~50% vs Windows for equivalent hardware

The Windows premium is purely the license. Workloads that don't need Windows (most web/app tiers, containers) run ~2x cheaper on the identical Linux size.

Auto-deallocate non-production VMs off-hours

~60% of compute on non-prod

Deallocated VMs stop billing compute. A schedule that deallocates dev/test VMs nights and weekends cuts compute to ~40% of a 24/7 month (the disk still bills).

Reserve steady production VMs

40–60% on steady compute

A 1-year reservation is ~40% off and a 3-year ~60% off, and stacks with Hybrid Benefit for the deepest total discount on always-on Windows VMs.

FAQ

Why does a Windows VM cost about twice a Linux VM?

The hourly rate for a Windows VM includes a per-core Windows Server license; the Linux rate is the bare compute. For an identical size, that license roughly doubles the price. Azure Hybrid Benefit lets you bring your own license to close the gap.

Does Azure Hybrid Benefit really cut the cost that much?

Yes — it removes the license portion of the compute rate, bringing a Windows VM close to the Linux price (up to ~40% off the Windows rate). It requires eligible Windows Server licenses with Software Assurance, and stacks with reservations.

Does a stopped Windows VM still cost money?

Only 'Stopped (deallocated)' releases the compute charge. A VM merely 'Stopped' from inside the guest still reserves capacity and bills. The OS and data disks bill in both states regardless.

How does c3x price the Windows VM?

It prices compute from the size at the Windows rate, and the OS disk from os_disk_storage_account_type and os_disk_disk_size_gb mapped to Azure's tier ladder. Hybrid Benefit and reservations are modelled separately.

Related resources

Estimate this resource in your own Terraform

Free, open source, no API key. C3X parses your Terraform and shows line-item cost for every resource, including azurerm_windows_virtual_machine.