Deleting an Azure VM does not delete its disks, and an Unattached disk keeps billing. How to list them with az disk, snapshot, delete and prevent them.
Deleting a VM does not delete its data disks: they stay Unattached and Azure keeps billing them by provisioned size.
Policy at a glance
Provider
Azure
Resource
Azure managed disks (Premium SSD, Premium SSD v2, Standard SSD, Standard HDD, Ultra Disk).
What to check
Disks with an empty managedBy, which the portal shows as Disk state = Unattached.
Risk
Low with a snapshot first. Microsoft warns it plainly: deleting a disk is permanent.
Effort
Low: one query per subscription and one delete per disk.
Why it matters: the disk outlives the VM and keeps billing
The Azure documentation is explicit: when you delete a virtual machine, by default the attached disks are not deleted. It protects against data loss from an accidental deletion, at a price: after the VM is deleted, you keep paying for the unattached disks.
And they are paid by provisioned size, not by data written. Premium SSD, Standard SSD and Standard HDD are billed by performance tier, which is set by the capacity you choose (a 1 TiB disk is P30, E30 or S30). The disk types page adds that billing is prorated hourly from the tier's monthly price, regardless of how much data the disk holds. Premium SSD v2 and Ultra Disk are billed per GiB plus the IOPS and throughput provisioned above the baseline.
For a sense of scale, Azure's public price API (Azure Retail Prices, queried on 15 November 2026, East US region, pay-as-you-go) returns USD 19.71 per month for a Premium SSD P10 LRS and USD 9.60 for a Standard SSD E10 LRS, both 128 GiB. A P10 forgotten for a year is over USD 230 for a disk that reads and writes nothing.
The exception: a freshly created empty disk that was never attached and never received data has no storage allocated yet, and according to Microsoft it incurs no charges until its first use.
How to find them
In the portal: search for Disks, open the disk and confirm Disk state says Unattached. The list view lets you add the state column and sort by it.
With the official CLI, Microsoft's script relies on the managedBy property: when the disk is attached it holds the VM ID, and when it is not it is null. This query lists the ones in the active subscription:
az disk list \
--query "[?managedBy==null].{Name:name,Group:resourceGroup,GiB:diskSizeGb,SKU:sku.name}" \
--output table
To decide, add when it came loose: az disk show --ids <id> --query LastOwnershipUpdateTime returns when its state last changed, which for an unattached disk is the moment it was detached. The resource group and the tags usually tell you whose it was.
How to fix it, step by step
Check tags, resource group and LastOwnershipUpdateTime. A disk detached months ago from a VM that no longer exists is the candidate; one detached hours ago may be a migration.
Take an incremental snapshot before deleting: az snapshot create --resource-group <rg> --name <disk>-final --source <disk-id> --incremental true. Snapshots are billed by used size, not provisioned size, and incremental ones store only the differences.
Wait until the snapshot finishes.
Delete the disk: in the portal, from the disk, Delete; with the CLI, az disk delete --ids <disk-id> --yes. Microsoft says it plainly: deletion is permanent and the data cannot be recovered.
If there are many, the script in the official documentation walks the whole subscription: run it first in list mode (deleteUnattachedDisks=0), review the output, and only then in delete mode.
Terraform example: prevent and back up
With the azurerm provider, delete_os_disk_on_deletion = true in the features block makes azurerm_linux_virtual_machine and azurerm_windows_virtual_machine delete their OS disk when the VM is destroyed (it is the default; writing it makes the intent visible). Data disks are best declared in the same state as their attachment, so they are destroyed together. The second half snapshots an existing orphan disk before deleting it.
provider "azurerm" {
features {
virtual_machine {
delete_os_disk_on_deletion = true
}
}
}
variable "resource_group" { type = string }
variable "location" { type = string }
variable "vm_id" { type = string }
# Prevent: the data disk and its attachment live in the same state.
resource "azurerm_managed_disk" "datos" {
name = "app-datos"
resource_group_name = var.resource_group
location = var.location
storage_account_type = "StandardSSD_LRS"
create_option = "Empty"
disk_size_gb = 128
}
resource "azurerm_virtual_machine_data_disk_attachment" "datos" {
managed_disk_id = azurerm_managed_disk.datos.id
virtual_machine_id = var.vm_id
lun = 0
caching = "ReadWrite"
}
# Fix: incremental snapshot of an orphan disk before deleting it.
data "azurerm_managed_disk" "huerfano" {
name = "disco-sin-adjuntar"
resource_group_name = var.resource_group
}
resource "azurerm_snapshot" "antes_de_borrar" {
name = "disco-sin-adjuntar-final"
resource_group_name = var.resource_group
location = var.location
create_option = "Copy"
source_uri = data.azurerm_managed_disk.huerfano.id
incremental_enabled = true
}
Validated with terraform validate (Terraform 1.17.2, hashicorp/azurerm provider 4.81.0).
How Control Cloud surfaces it
Control Cloud reads every disk with its managedBy and its usage state. An Unattached disk shows up in the disks tab as idle, with the warning that it keeps billing and "Unattached" in the VM field, and the "Orphans" filter gathers all of them in the region. On the canvas, a disk with a VM hangs from it and one without is flagged on its own.
When not to apply it
Disks detached to move them to another VM, resize them or investigate an incident. Tag them with an owner and a date instead of deleting them.
Shared disks or cluster disks that are attached and detached as part of a failover: a momentary "unattached" is normal there.
A freshly created empty disk costs nothing until its first use; deleting it saves nothing, though it is still worth knowing why it exists.
Unmanaged disks (VHDs in storage accounts): they do not show up in az disk list. Microsoft has a separate script that checks the lease status of each blob.
Frequently asked questions
Does Azure bill a managed disk that is not attached to any VM?
Yes. Microsoft says so in the unattached disks guide: after a VM is deleted you keep paying for its disks. They are billed by provisioned size, prorated hourly, regardless of how much data they hold.
Why doesn't Azure delete the disks when I delete the VM?
To prevent data loss from an accidental VM deletion. That is why they have to be deleted separately, or set to be deleted with the VM when you create or delete it.
How do I know how long a disk has been unattached?
With az disk show and the LastOwnershipUpdateTime property: on an unattached disk it shows when it was detached. On new disks it stays blank until their state changes.
Does the snapshot I take before deleting cost as much as the disk?
No. Snapshots are billed by used size: a full snapshot of a 500 GiB disk with 50 GiB in use is billed for 50 GiB, and incremental ones store only the differences on Standard HDD storage.