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_
A Standard_
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_
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_.
| Dimension | Unit | What's being charged |
|---|---|---|
| Compute (Windows, by size) | per hour | Set 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 disk | per disk-month | Flat 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-month | Each azurerm_ |
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.24Optimization tips
Common ways to reduce azurerm_ cost without changing the workload.
Apply Azure Hybrid Benefit
Up to ~40% of computeIf 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 hardwareThe 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-prodDeallocated 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 to 60% on steady computeA 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_
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_.