In this article, I will show you how to enable auto shutdown Azure virtual machines. You can configure the auto shutdown while creating a new VM in Azure or on existing VM’s.
The auto-shutdown feature in Azure allows you to configure the shutdown schedule for virtual machines. Based on the schedule you set, the Microsoft Azure VMs automatically shutdown. This is a great feature to save your money.
I have got Azure subscription with a limited number of credits. I never want to leave my Azure VM’s running when they are not in use, especially the test VM’s that I create.
Sometimes the virtual machines that you create in Azure don’t need to be running all the time. Running the Virtual Machines require Azure credits and if you keep them running, you must pay and this can empty one’s pockets.
The Azure Virtual Machine auto-shutdown was first introduced by Microsoft in year 2107, and you can configure the auto-shutdown of VM’s in Azure portal.
If you are doing many VM deployments, a Microsoft Azure Resource Manager template is the best way to go. Enabling and configuring the auto-shutdown feature in Azure through ARM templates is effortless.
Auto Shutdown Azure Virtual Machines
If you have created Virtual Machines in Azure and you want to configure auto-shutdown, you can do it with following steps.
First login to Azure Portal and click Virtual Machines. If you don’t find that option, use the search bar to locate Virtual Machines. Now select a Virtual Machine and under Operations, select Auto-Shutdown.
In the right pane, configure the following auto-shutdown settings.
- Enabled – Select On to enable Auto Shutdown Azure Virtual Machines.
- Scheduled Shutdown – Select the time at which you want to shut down the VM.
- Time Zone – Select the time zone based on the region that you are located.
- Send notification before auto-shutdown – Select Yes to enable the notifications.
- Webhook URL – A notification will be posted to the specified webhook endpoint when the auto-shutdown is about to happen. The endpoint must support incoming TLS 1.2 connections.
- Email Address – Provide a set of semicolon-delimited email addresses to receive alert notification emails. An email will be sent from Microsoft Azure 30 minutes before the virtual machines are shutdown.
After you configure the above settings, click Save.
Keep an eye on the notifications to confirm if the auto-shutdown feature is successfully enabled. The update of schedule successful confirms the auto shutdown has been enabled on the virtual machine.
Based on the auto-shutdown settings, I got emails from Microsoft Azure just 30 minutes before the Virtual Machines were about to shut down.
Microsoft Azure Alert – Your virtual machine in Azure DevTest Labs will automatically shut down
Virtual machine CLOUDVM3 (mecmlab_resourcegroup) is scheduled to shut down in 30 minutes. You may postpone or skip this instance:
- Postpone: 1 hour
- Postpone: 2 hours
- Skip this instance
You can postpone the shutdown from next 1 hour, 2 hours and also skip this instance. Note that if you postpone the shutdown, a new notification will be sent 30 minutes before the new shutdown time.
Enable Auto-Shutdown for New Virtual Machines in Azure
If you are creating a new virtual machine in Microsoft Azure, you get the option to enable the auto-shutdown.
- Launch the browser and go to portal.azure.com.
- Select Virtual Machines and click Create > Virtual Machine.
- Click the Management tab and under Auto-Shutdown, select Enable auto-shutdown.
- You can also configure the shutdown time, time zone and notification before shutdown.
If you don’t configure the Notification, you won’t get any emails however the virtual machines in Azure will be shutdown at scheduled time.