An Azure personalized recommendation engine that helps users follow best practices to optimize Azure deployments.
To stop being charged for unused Azure VM resources and safely remove them, follow these steps:
- Deallocate or delete unused virtual machines
- Deallocating a VM stops compute charges but keeps disks and networking resources:
Use Azure portal, CLI, or PowerShell to stop the VM so it enters the Deallocated state. Deallocated VMs do not incur compute charges, but disks and other components still incur costs. - If the VM is no longer needed at all, delete it. This removes the VM resource but can leave supporting resources (disks, networks, etc.) behind, so continue with the next steps.
- Deallocating a VM stops compute charges but keeps disks and networking resources:
- Identify and remove unused or orphaned resources
After deleting or deallocating VMs, some resources can remain and keep accruing charges:- Managed disks (OS and data disks):
- OS disks are usually deleted with the VM by default, but this can be disabled at creation time. Any remaining OS or data disks continue to incur storage costs until deleted.
- In the portal, go to Disks, filter by resource group or subscription, and delete disks not attached to any VM and not needed for backup.
- Virtual networks and IP addresses:
- Virtual networks themselves can incur bandwidth-related charges, and public IP addresses can be billable.
- Check for virtual networks, NICs, and public IPs that are no longer used by any VM and delete them if they are not required for other workloads.
- Load balancers and other networking components:
- Load balancers, if present, can incur charges based on rules and data processed. Remove unused load balancers and related resources.
- Managed disks (OS and data disks):
- Delete entire resource groups when appropriate
If a VM and all its supporting resources were created in a dedicated resource group for testing or learning, the simplest way to clean up is to delete the whole resource group:- Deleting the resource group removes the VM and all associated resources (disks, networks, IPs, etc.) in one operation, which stops all charges for those resources.
- This is recommended when the group contains only resources that are safe to remove.
- Regularly inventory and clean up unused resources
- Take an inventory of all resources in the subscription and identify those that are idle, orphaned, or no longer needed (for example, test environments, demo builds, old snapshots, unused IPs, and storage accounts).
- Remove idle components rather than leaving them deployed but unused. If data is needed, back it up first, then delete the resource.
- Understand what is billed for a VM
To avoid unexpected charges in the future, be aware that a VM’s cost is not just the VM itself:- Virtual machine compute: billed per hour, varies by size and region, and depends on the VM state.
- Storage: OS and data disks are billed based on disk type and size.
- Networking: bandwidth, public IPs, and load balancers can incur charges.
- Other services: Azure Monitor, Bastion, DNS, and premium marketplace software have their own meters.
- Use cost-optimization practices
- Deallocate VMs when not in use instead of just shutting them down inside the OS.
- Periodically review cost reports to detect idle or underutilized resources.
- Remove unused resources promptly to avoid ongoing charges.
If unsure which specific resources are safe to delete, start by identifying VMs that are no longer needed, then trace and remove their associated disks, networks, and IPs, or delete the entire resource group they reside in.
References: