How to Auto shutdown Microsoft Azure Virtual Machine

In this blog post we will see how to configure auto shutdown schedule of a Virtual machines in Microsoft azure. This is really a useful out of the box feature to save your spending on cloud workloads by shutting down VM’s when not in use.

For example, if you know that the your company employees will be using the virtual machines from 9 AM to 5 PM. Then in that case, running the VM’s outside of this time is unnecessary cost. Therefore, you can configure an Auto shutdown of the VM’s and set it to shutdown at 5 PM every day.

Auto shutdown a VM also puts the VM in Stopped / deallocated stage instead of just a VM shutdown. When a VM is in stopped / deallocated stage, you will not be paying for VM compute. Please note that you will continue to pay storage cost associated with the VM which is not much compared to compute cost.

If you are using Azure virtual desktop (AVD) then you can also utilize a setting in host pool called Start VM on connect. This will power up a stopped / deallocated virtual machine when a user tries to connect to it.

Start VM on Connect

Configuration of Auto Shutdown of a Azure Virtual machine is very easy. Just follow below steps to configure:

  • Login on Microsoft Azure Portal
  • Search for Virtual machines
  • Find the Virtual Machine from the list on which you want to enable auto shutdown and click on it
  • Scroll down on the page and under operations you will find Auto-shutdown
Auto shutdown Microsoft Azure Virtual Machine
  • Select Enable: On
  • Scheduled shutdown: Set the time when you want to shutdown this VM everyday.
  • Time zone: Set the time zone
  • Send notification before auto-shutdown?: Yes
  • Webhook URL: Keep Empty
  • Email address: Email will be sent to this email address 30 minutes before the machine will shutdown. You will also have the option in the email to postpone the shutdown of the VM.

Below is the example email I have received. This screenshot if from the shutdown I configured on one of my Azure Virtual Desktop Personal desktop. Please ignore the heading of the email which says “Your virtual machine in Azue DevTest Labs will automatically shut down.”

Even though I do not have any Azure DevTest Lab configured, this email refer to it which is a bit misleading. Hope this might update in future. However the notification is useful and also provides you with options to postpone the restart of your VM.

Email Notification
Your virtual machine in Azure DevTest Labs will automatically shut down
Virtual machine avd-tp-0 (AVDrg) is scheduled to shut down in 30 minutes. You may postpone or skip this instance:

Postpone: 1 hour >
Postpone: 2 hours >
Skip this instance >

Note that if you postpone the shutdown, a new notification will be sent 30 minutes prior to the new shutdown time.
Auto shutdown Microsoft Azure Virtual Machine Email Notification

Azure VM Auto shutdown Email notification not received

If you have newly configured Azure VM auto shutdown and also configured an email address for sending the notification and not yet received the notification then you need to make sure that you give at least 30 minutes for the notification to be sent otherwise the schedule will be skipped and apply from next day. For Example: If its 11:00 AM now and you have configured an Auto shutdown of a Virtual Machine for 11:15 AM. This will not work and you will not receive any email notification but the schedule will apply for next day at 11:15 and you can expect an email notification as well.


Auto shutdown of virtual machines is a cost saver and should be used in any organization specially when you are working on dev and UAT environments where you not working on the VM’s all the time. These machines are only used when you are developing applications. Outside office hours you should not pay for compute costs for these VM’s. Therefore, Identify these types of VM’s and configure the auto shutdown and you will see the next monthly bill will be reduced a lot.