Blog Post

ITOps Talk Blog
4 MIN READ

Am I billed for an Azure Virtual Machine if it's shut down?

SoniaCuff's avatar
SoniaCuff
Icon for Microsoft rankMicrosoft
Jun 17, 2021

Come to the cloud, it has consumption-based billing! But what does that mean, exactly? Is my virtual machine free if it is shut down? Let's explore the billing components of an Azure Virtual Machine.

 

Resources in Azure all have particular cost meters and charging methods. Each product page details what those are. For consumption-based billing, you need to broaden your perception of what the word "consumption" means. You might think you're not consuming the services of a virtual machine if it is shut down, but it is a little more comprehensive than that.

 

Azure Virtual Machine components

When you create a Windows Virtual Machine in Azure, you don't get just one resource. An Azure VM relies on 5 resources, created by default:

  • Virtual machine
  • Disk
  • Network interface
  • Virtual network (or choose to use an existing virtual network)
  • Network security group (optional but highly recommended)

If you want to make this VM publicly available over the internet, you also need a Public IP address.

 

Azure Virtual Machine resources

Now lets look at which of those components have billing implications when the VM is shut down.

 

The virtual machine resource - power states and billing

The state of the virtual machine impacts whether the virtual machine resource is being billed or not, in relation to the virtual machine resource and its reliance and use of underlying hardware.

 

Running - The virtual machine is powered up and working, and currently being billed for.

 

Stopped - The VM has been shut down from within the guest operating system or using PowerOff APIs. The VM will be showing as Stopped. This does not release the lease that the VM has on the underlying hardware, which means the hardware is unavailable for other customers. In this state, the virtual machine is still billed for.

 

Deallocated - The VM has released the lease on the underlying hardware and is completely powered off, so the virtual machine resource is not billed. It will appear in the Azure portal as Stopped (Deallocated).

 

Azure Virtual Machine status

 

What if I have the VM scheduled to shut down automatically on a schedule?

The shutdown automation provided natively by Azure puts the machine in the Deallocated state, so it is not being billed while it is shut down. See Start/stop VMs during off-hours overview.

 

What if I shut the VM down using PowerShell?

The Stop-AzVM PowerShell cmdlet also puts the machine in the Deallocated state, so it is not being billed while it is shut down.

 

What if I shut the VM down using the Azure CLI or Cloud Shell?
It depends on which command you use. az vm stop will not deallocate the VM from the hardware and will display the warning "About to power off the specified VM... It will continue to be billed. To deallocate a VM, run: az vm deallocate"

 

For more information, see States and billing of Azure Virtual Machines.

Billing of other Azure Virtual machine components

Even if the virtual machine is deallocated and not consuming "compute" time (holding a lease on hardware), there are components of this virtual machine that you are still using. Most commonly, this is storage and networking.

 

Storage - disk costs

While the VM is shut down, there is still a storage cost for the disk that is holding the virtual hard drive file, as well as any other data storage disks you may have created, as you are still consuming file storage.

 

This resource group contains a VM that was shut down for the month of May and incurred a USD$0.31 daily cost for a 127GiB Premium SSD disk with locally redundant storage including a less than USD$0.01 charge for the storage account.

 

Deallocated virtual machine costs

 

See Managed Disks pricing. 

 

Note: There's another type of storage for Azure VM operating systems called Ephemeral OS Disks. These are free and suitable for stateless workloads, but don't support features like Azure Backup, Azure Disk Encryption, Disk snapshots or Azure Site Recovery. Learn more at Ephemeral OS disks for Azure VMs.

Networking

The network interface, virtual network and network security group will not incur any charges. Visit Virtual Network pricing.

A static Public IP address will still be billed if the VM is shut down or even deleted, unless you delete the static public IP address. For pricing, visit IP Addresses pricing.


Azure Bastion (optional)

Azure Bastion allows for secure remote access to your virtual machine guest operating system via a browser, without needing to open RDP port 3389. Regardless of the state of your virtual machine, you will be charged for any Azure Bastion hosts. If you use this infrequently, you can delete and recreate an Azure Bastion host when needed. Learn more about Azure Bastion pricing here.


Other related Azure services

Other services related to Azure Virtual Machines may also incur a cost while a VM is shut down, including Azure Defender for Servers and Azure Backup.  Both Azure Arc enabled servers and Azure Lighthouse, for server management, are free capabilities.


Learn more at Microsoft Learn

 

Updated Jun 17, 2021
Version 2.0
  • jasonCbraatz's avatar
    jasonCbraatz
    Copper Contributor

    Yah ours was definitely de-allocated.  But what's frustrating is that many of us are trying to save our money for our company - at least in the long run when factoring in cost of replacing hardware - when jumping to a cloud environment or using cloud-based VMs.  It should be simpler and easier and it should come with near-automatic controls on when a system is offline versus online.  I understand that some VMs require it to be online all the time (in the case of a website or intranet) but those VMs used as remote workstations should be easy to configure and easy to price.  They have the easy-to-configure part down nicely.. not the easy to price.  If this is the future, then I really hope there's a lot more transparency on this and I think they'd see their growth numbers skyrocket.  Some of the apprehension we've had internally is because this pay-by-the-hour concept requires a solar calculator to figure out a ballpark cost.. and even then, it's a ballpark.  Sorry for the rant 😉

  • sguidos's avatar
    sguidos
    Copper Contributor

    No response from Microsoft.   But it turns out that the VM in question was stopped but NOT "deallocated" for its first 7 days, which I did not notice from reading through the logs (my fault there).  So (7 days * $5/day) pretty much explains my $34 bill.  Your situation seems more severe for only 20 hours of use 😞

  • jasonCbraatz's avatar
    jasonCbraatz
    Copper Contributor

    I have the identical question..

     

    Same scenario.  We had a difference of $100 in our case for about 20 hours of usage .. $104+ for Azure, and $3.89 in AWS.  Any response from Microsoft?

  • sguidos's avatar
    sguidos
    Copper Contributor

    I am new to Azure.  I created an "D2 v3/D2s v3" VM in April (this month) with a 32GB disk drive, under my company's subscription.  Including the initial VM creation, the VM was "on" 4 times during the month of April and was up and running for less than 60 minutes total.  I also made sure the VM was "deallocated" when turned off, and there is no static IP.  I have the Azure Activity logs to show all this.  So far this month that VM has costed the company almost $34.

     

    I have an EC2 VM on AWS with similar specs, on my personal account, which I used for well over 6 hours in March, and it cost me a grand total of 60 CENTS. This cost is exponentially less than the cost of my similar-spec'd Azure VM.

     

    What am I missing? Why is Azure so much higher, and what can I do to get the costs down to the level of AWS?