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 Microsoft Certified Azure Solutions Architect and developer, a Microsoft Certified Trainer (MCT), 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!” }


  8. Is there such a thing as ‘hibernate’ or ‘sleep’? So applications will still be open but the hardware will be deallocated? I’m setting up an ’emergency’ dev machine and I’d like to leave things open.


    1. Chris Pietschmann March 19, 2018 at 9:01 pm

      Nothing supported in Azure did directly. You may be able to do it; I have not tried to hibernate an Azure VM before reallocating…


  9. Phanindra Pokala March 23, 2018 at 3:22 am

    Hi Chris,

    Will there be any change in IP address if i STOP and START the VM from the portal?

    Also will there be any impact on the applications installed on that server?

    Thanks in advance.


    1. Chris Pietschmann March 23, 2018 at 7:43 am

      By default, Azure VMs will have a Dynamic IP Address assigned to them so when they are Deallocated then the IP Address can/will change. However, you could configure your VMs to have Static IP Addresses, then they would not change when deallocated.

      As far as applications installed on the server, these would have no effect from deallocation itself. When stopping and deallocating a VM you are essentially doing the same as turning off the VM or machine, so you should expect normal behavior as you would expect here.


  10. Auto-Shutdown doesn’t have a time of auto-boot
    Is there a way I can set the start time as well?


    1. Chris Pietschmann April 3, 2018 at 7:53 am

      No, Auto-Shutdown does not enable you to set a startup time. You could use scripts to automate this yourself. The main purpose is for Dev/Test environments where you manually start up the VM when necessary then you don’t have to worry about shutting it down later.


    2. There’s an app to start your Azure VM on demand, so you or your users don’t need to go to the portal. You can sing up for a free trial here:


  11. […] Obs3: Note que desalocar é diferente de desligar. Ao desalocar uma VM, você não somente para a execução da VM como também libera recursos de rede e computação que foram provisionados para ela. Saber desalocar VMs adequadamente ajuda a economizar. […]


  12. Is it possible to somehow execute a Stop(deallocate) from within the vm without extra permissions?
    eg: shutdown –deallocate


    1. Chris Pietschmann June 7, 2018 at 10:44 am

      You could use the Azure CLI or PowerShell but not without permissions to Azure.


    2. You can delegate the permission to deallocate the VM to this web app and set up any user to deallocate the VM within the app. Check it out here:


  13. […] need to stop/deallocate the VM from the Azure portal (or PowerShell) to stop allocation billing when not using the VM (you […]


  14. Hi Chris
    Thanks for this life saver article. I am getting upto speed on Azure using my company provided MSDN VS professional subscription.
    This is a tip which every beginner Azure Developer should familiarize themselves with! Thanks a bunch mate.


    1. Chris Pietschmann March 25, 2019 at 11:00 pm

      Thanks Rahul! I’m really glad my article has helped you. Please subscribe to the Build Azure Weekly newsletter if you haven’t already to get weekly status updates on Microsoft Azure in your email every week. 🙂


  15. […] Properly Shutdown Azure VM to Save Money […]


  16. Hi Chris,

    I have allocated Static IP for my VM.
    Now my question is if I write a script to Start and Stop the VM on a schedule, will I lose the Static IP ?

    Thanks for you article, I thought if we stop the VM, we are not paying anything, but came to know we do pay for Storage 🙂

    Sunil Nokku


    1. Chris Pietschmann July 15, 2019 at 10:21 pm

      If you have a static IP configured, then deallocating your VM will not affect the IP address. With the IP set as Static, it’s reserved for your use regardless of the state of the VM.

      Always glad to help. Thanks!


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.