Kristi Webb is a Senior Consultant at ThreeWill. She has over 18 years of software development experience working on software solutions and integrations for enterprise and product solutions. Her passion is applying technology solutions to solve business problems and improve efficiency.
Like all companies, everyone at ThreeWill tries to be careful with our spending; and as you probably already know, when using Azure that means only using resources when we actually need to use them. In our case, test and development virtual machines are the most commonly used Azure resources, so we include configuring automatic shutdown as part of our standard VM setup.
Recently on a project, a colleague pointed me to an existing ThreeWill Blog named “Configure Scheduled Shutdown for Virtual Machines in Azure” to find the steps for configuring automatic shutdown for our new Azure QA virtual machine. This older blog post details all the steps you previously had to follow to get auto-shutdown enabled; however, I found a much-improved way to do this using a Microsoft feature that had been added since the original article was posted. We wanted to update our blog post content by documenting this improved option.
In Azure, find your VM resource and select it to view all the options for that particular virtual machine. Scroll down through the options, and under the “OPERATIONS” section, you will see a configuration option named “Auto-shutdown”.
If you go to this configuration item, you will see the following options for setting when the Virtual Machine will automatically shut down.
You should set “Enabled” = On as shown above, and then enter the time for “Scheduled shutdown” and set the related “Time zone”. This is the time that the VM will automatically shut down each day if it was turned on that day and is still running during the ‘Scheduled Shutdown’ time.
Of course, if you would like to get a warning reminder before the automatic shutdown occurs, you can set “Send notification before auto-shutdown” = Yes. This can be especially helpful if you are still using the VM when the Scheduled Shutdown time occurs and need to continue working, especially so you do not lose any unsaved work. In our case, we set up an email reminder that goes to the Tenant Admin. Another option is to set up a Webhook which can give you options to just be notified, delay the shutdown for one or two hours, or completely skip the automatic shutdown that day. Read more about setting up a Webhook URL.
We all have Azure credits as part of our MSDN subscriptions, so we are primarily creating VMs for development, testing, and POC purposes. If you have a more advanced operation that has access to Azure Automation, then you have even more options for managing VM start-up and shut-down settings.