There are 2 ways to shutdown an Azure VM, and they are certainly not equal! One way you will still get charged for the compute resources, and the other will free you from paying for the compute resources and help you reduce overall cost.

The first method to shutdown an Azure VM, that sounds logical in the context of connecting with Remote Desktop, is to Shutdown the Operating System. In this scenario you would be connected with Remote Desktop, and when done with your work you go to the Power options within Windows and select Shutdown. This will essentially “turn off” the VM and stop it from running. However, even though the VM won’t be running you WILL still be paying for the Virtual machine hardware allocation. Doing this will cause the Azure Portal to report the status of the VM to be “Stopped”.


The second method, and the one to remember, is to go into the Azure Portal (or use Azure PowerShell or Azure CLI) and Stop the VM. Instead of just shutting down the Operating System, Azure will also deallocate the hardware (CPU and Memory) allocation; thus releasing it to be used for another workload in Microsoft Azure. Doing this will cause the Azure Portal to report the status of the VM to be “Stopped (Deallocated)”.

While in the “Stopped (Deallocated” status, you will not be paying for the VM resources.

It’s a good idea that when ever you don’t actually need the VM to be running that you Stop it using the Azure Portal, PowerShell, or Azure CLI so that the resources are released. While in the “Stopped (Deallocated” status, you will not be paying for the VM resources. This will really help you save money!

Manually Shutdown

To “properly” Stop a VM in the Azure Portal to release the resources and save money, you can follow these steps:

  1. Within the Azure Portal, navigate to the Virtual Machine blade for the desired VM.
  2. On the Overview pane, click the Stop button.

There is one caveat to be aware of when shutting down an Azure VM so it gets placed into the Stopped (Deallocated) status. Since this causes Azure to release the server resources associated with the Virtual Machine, it not only releases the CPU and Memory resources but also the Dynamic IP Address allocation. Due to this, when you Start the VM back up again, the IP Address will likely change. If you require the IP Address to never change for your VM, then you’ll need to configure a Static IP Address for the VM.

To start up a Stopped VM, you can follow these steps:

  1. Within the Azure Portal, navigate to the Virtual Machine blade for the desired VM.
  2. On the Overview pane, click the Start button.

Another point that’s important to remember when stopping Azure VM’s and placing them into the “Stopped (Deallocated)” state is that you do still pay for the Azure Storage account usage. Remember, the Storage account is where the VM’s .vhd disk image file is stored. Stopping the VM retains all the VM’s settings / configurations, as well as the .vhd image stored in Azure Storage. As a result, you will still incur some cost for the storage, but at least you will save on the VM resources. After all, the Storage will only cost a small amount of money compared to the much higher cost of the Virtual Machine resource allocation if it were left running constantly.

Schedule Auto Shutdown

Manually shutting down a VM to put it in the Stopped (Deallocated) status is a great way to save cost on Azure VM’s. Although, you do need to remember to Stop the VM. This introduces a certain level of human error in the process of saving you hosting costs on your Azure VMs. As a result, Microsoft has added a scheduled auto-shutdown feature into the platform to assist you in this effort.

With the Auto-shutdown feature, you are able to configure a specific Time (with Time Zone) when Azure is to automatically shutdown the VM. When configured, the VM will automatically be stopped if it is still running at that time of day.

To configure Auto-shutdown of an Azure VM, you can follow these steps:

  1. Within the Azure Portal, navigate to the Virtual Machine blade for the desired Virtual Machine.
  2. In the list of links on the Virtual Machine blade, click on Auto-shutdown.
  3. On the Auto-shutdown pane, configure the specific TimeTime Zone, and desired notification Webhook URL settings, then click Save.

If you forget to Stop your VM at the end of the day, or whenever the Auto-shutdown time is configured it will get Shutdown automatically. When using a Visual Studio development VM, this can become a good thing on Friday afternoons (or any other day when you might be in a hurry) when you’re most likely to forget to shutdown the VM.

Posted by Chris Pietschmann

Chris is a Microsoft MVP and has nearly 20 years of experience building enterprise systems both in the cloud and on-premises. He is also a Certified Azure Solutions Architect (both MCSD and MCSE), a trainer, and Cloud Advocate. He has a passion for technology and sharing what he learns with others to help enable them to learn faster and be more productive.


  1. is this option available for azure gov? we are using the arm portal and don’t see the “scheduling” menu or the “auto-shutdown” option.


    1. If it’s not there then you probably can’t do it. Azure Gov Cloud is always a bit behind the Public Cloud on features, unfortunately.


  2. Can’t find it in the Azure MSDN Subscription Holders as well. I wonder if there’s a powershell command for this?


  3. Hi Chris, is there a powershell command to create the schedule? I’d like to include it on my powershell script that provisions my test servers.

    Thanks, Brian


  4. Does the autoshutdown act like someone pulling the plug on a physical server? I have an Azure VM with SQL Server installed and I don’t want any data to get corrupted.


    1. It will properly shutdown the OS first. The Azure VM Agent is used for Azure to be able to “reach into” the VM and tell the OS to shutdown before it stops the Virtual Machine.


  5. Chestere baring August 7, 2017 at 4:51 am

    Hello chris, thank you for sharing this. I would also like to ask, if vm is stopped(deallocated), what we are paying will be the storage, like SSD? Or the whole related storage? Thank you


    1. Chris Pietschmann September 20, 2017 at 8:30 am

      When a VM is Stopped and Deallocated then all you are paying for is the Storage. If a VM is just Stopped, then you are still paying for the VM allocation and Storage.


  6. Abhishek Kulkarni August 8, 2017 at 12:07 am


    I am facing the error, “Couldn’t configure the Auto-shutdown feature. Close the virtual machine blade and try again. Error: [object Object]” while I’m using the Auto-Shutdown. How do I solve it? Do I need to have some specific role for my subscription?

    Thank you,


    1. Chris Pietschmann September 20, 2017 at 8:29 am

      Here’s some help on Azure Portal errors:


  7. Until MS might find it necessary to allow Auto-Dealloc of a stopped VM, it is possible to use Azure Automation for this. To deallocate a stopped VM, create a powershell runbook that issues a Stop-AzureRmVM when a VM in stopped-state is detected.

    The script looks essentially like this (add login and subscription selection, then run it via an hourly schedule):

    $powerstateMask = ‘PowerState/*’
    $powerstateStopped = ‘PowerState/stopped’
    $powerstateDealloc = ‘PowerState/deallocated’

    $VM = (Get-AzureRmVM -Name $vmName -ResourceGroupName $resourceGroupName -Status)

    if(!$VM) { Write-Error “VM ‘$resourceGroupName’ does not exist.” }
    $vmState = ($VM.Statuses | Where Code -Like $powerstateMask)[0]
    Write-Output (“Current PowerState of VM is ‘{0}'” -f $vmState.DisplayStatus)
    if($vmState.Code -eq $powerstateStopped)
    # Note: Deallocation via Stop-AzureRmVM is blocking (might take 1-2 minutes)
    Write-Verbose “Going to deallocate the VM (this might take a minute)…”
    Stop-AzureRmVM -Name $vmName -ResourceGroupName $resourceGroupName -Force
    Write-Verbose “Done!”
    else { Write-Verbose “All is fine!” }


Leave a Reply to Brian Cancel reply