Skip to main content
Five Steps for Cloud Compliance Readiness·A practical playbook for security teamsDownload
Insight · Microsoft Azure

Unattached disks

An unattached disk is an Azure managed disk that is not connected to any virtual machine. It still exists and still costs money, and it may still hold data, so it is worth finding and then deciding whether to keep, snapshot or delete it.

Why it matters

When a virtual machine is deleted, its data disks are not always deleted with it, and the disks stay in the subscription until someone removes them. Microsoft documents how to find these orphaned managed and unmanaged disks and notes that you pay for them while they exist (Microsoft Learn: Find and delete unattached Azure managed and unmanaged disks).

There is a security side too: a forgotten disk can still contain old application data or credentials, and nobody is looking after it. Cleaning them up reduces cost and the amount of data you have to protect.

Find it yourself

This script is read-only: it only runs az account list and az disk list, which read metadata and change nothing. You need the Azure CLI (install guide) and at least the Reader role on the subscriptions (az disk list reference).

az login

for sub in $(az account list --query "[].id" -o tsv); do
  echo "== Subscription $sub"
  az disk list --subscription "$sub" \
    --query "[?managedBy==null].{name:name, resourceGroup:resourceGroup, sku:sku.name, sizeGb:diskSizeGb, state:diskState, created:timeCreated}" \
    -o table
done

Read the result

Each row is a managed disk with no owner VM. Look at these columns:

  • state: Unattached confirms the disk is not in use.
  • sizeGb and sku: together they show how much the disk costs you. Larger and premium disks matter first.
  • created: an old disk is more likely to be forgotten, but age alone is not proof.
  • resourceGroup: often hints at which project or team owned the disk.

Some disks are unattached on purpose, for example a spare data disk kept for a planned VM, so confirm with the owner before acting.

What to do next

  1. Identify the owner from the resource group, tags or the activity history.
  2. If the data might still be needed, take a snapshot first.
  3. Delete the disks that are confirmed unused, following the steps in the Microsoft article above.
  4. Tag disks you keep on purpose, so the next review can skip them quickly.

See it continuously

ConfigCobra's Azure inventory covers resources across your subscriptions, and unattached disks are one of its built-in views for Azure. The relation graph shows Azure resource dependencies, findings link to the exact resources they concern, and you can export the list as CSV. Scheduled scans (daily, weekly or monthly) or an ad hoc scan keep the view current, and ConfigCobra only reads your Azure environment, it never changes it.

See it for your whole tenant, continuously

Inventory & Insights lists these risks with built-in views and CSV export, read-only.

Get in touch

Let's talk.

Whether you're evaluating ConfigCobra, running an audit, or managing a client fleet — we respond within one business day.

Free trial