Azure Billing

Avoid unexpected Azure charges

This article will look at some of the common ways someone may incur unexpected charges on their Azure subscription.

Azure Virtual Machines – Stopping versus Stopping (Deallocating)

When an Azure Virtual Machine is shutdown from the OS it goes into “Stopped” state, on the other hand when you stop a VM from Azure portal its put into “Stopped (deallocated)” state.

So what is the difference. 

Stopped

  • Intended to take the VM temporarily offline, for example maintenance.
  • VM continues to reserve Azure resources such as storage and IP address.
  • Azure continues to charge for these VM resource hours even if the VM was shutdown.

Stopped (deallocated)

  • If you don’t intend to use the VM for a long period or planning to decommion the VM.
  • Azure resources such as internal and external IPs are deallocated off the VM.
  • You would not be charged for any resources deallocated however you are still changed for any storage assigned to the VM.

To not incur any charges on a unused VM the best way is to delete the VM. But way… you are still charged after deleting the VM.

Find and delete unused Azure resources

When you delete a VM from Azure some resources aren’t deleted by default such as storage (Azure Bastion is another). As result you would still incur charges until these unused resources are removed.

Storage is the easiest to identify, run Get-AzDisk to get a list of managed disks in your Azure tenant. You are looking for disks with null value for ManagedBy field, also the DiskState is unattached symbolizing the disk is not attached to any VM at the time.

Microsoft documentation has two short scripts to identify unused managed and unmanaged disks see link at the bottom of this post.

Conclusion

Most large organizations are unlikely to put production virtual machines in “Stopped (deallocated)” state unless for decommission purposes.  For small business or someone like me running a home lab its ideal to put VMs in “deallocated” state to save on unwanted charges.

Regardless the size of the organization one should regularly check Azure for unused resources especially after major infrastructural changes where resources such as VM might be decommissioned.   

Any resource deployed on Azure should be clearly labeled for cost tracking purposes, this can lead to easier correlation when reviewing Azure billing report for unused resources.   

 

Sources, Additional Reading