Try for free Book a demo

A Comprehensive guide to auto-shutdown idle Azure VMs to maximize cost savings

Azure Cost Management

7 Mins Read | Last modified on March 6th, 2024

auto shutdown Azure VM when idle featured image

Virtual Machines (VMs) act as the foundation for the evolution of cloud computing. Business organizations utilizing virtualization for their applications will operate flawlessly only when the corresponding VM resources function without interruptions.

A cloud enterprise’s expenditure on VM resources is frequently high, as pricing varies according to its service tier. Research indicates that virtual machines responsible for non-production environments are typically used only during business hours rather than around the clock. Leaving VMs running during off-hours incurs significant Azure costs.

Turning off your idle VM resources is essential to reduce the money you spend on it. Since running business applications over the cloud is expensive, you should strategize to control your Azure spending.

Setting up an automatic shutdown procedure for unused virtual machine resources is the best way to optimize its cost.

Why is it necessary to auto-shutdown idle VMs?

Idle virtual machines typically run at their maximum capacity and inefficiently consume the CPU, memory, and network resources. Owing to their unproductive nature and high utilization, these virtual machines (VMs) will consume more cost than expected, swiftly exhausting your Azure budget.

Numerous factors affect virtual machine idleness. The significant ones include:

  • Minimal user interaction – VM resources become idle when no active services are running in cases when the workload is low (or) during off-peak hours.
  • Inefficient resource allocation – Under- or over-utilization of VM resource resources may result in performance degradation, eventually leading to prolonged inactivity.
  • Downtime of associated resources – The idle time of a virtual machine (VM) is directly affected by the state of the resources it uses for networking and storage, such as SQL Server.

The main objective of managing the cost spent on VMs is finding the factors that influence a VM’s idleness. Once these inactive VMs are terminated during off-peak hours, the resources assigned to them can be dynamically distributed according to demand, lowering the need for over-provisioning, and promoting effective resource utilization.

How do you auto-shutdown idle VMs using Native Tool?

Azure provides two popular ways to schedule virtual machine (VM) shutdowns during off-peak hours.

Method 1: Use of Auto-shutdown feature

Auto shutdown feature in Azure Portal

Azure has an integrated feature that allows you to schedule the shutdown of your virtual machine (VM) for a specific time and time zone. To access this feature, use the path below for an Azure virtual machine resource: Operations -> Auto-shutdown.

You can also specify a Webhook URL and an email address to receive alert notifications before auto-shutdown.

Drawbacks

You can use this feature to customize the shutdown time for each distinct virtual machine. The major drawback is that setting it up when using innumerable virtual machines can be challenging. Restarting them one at a time each day is also tiresome.

Method 2: Use of Azure Automation

Microsoft Azure provides Azure Automation, a tool for automating labor-intensive processes, cloud, and configuration services.

You can use Azure Automation to create a runbook that outlines a step-by-step process for automatically shutting down your VMs at a specified time.
The challenge with Azure Automation is that only all your VMs can be scheduled to stop simultaneously. Practically speaking, this can only be helpful in some business scenarios.

Drawbacks

The only other option available when using Azure Automation is to start and stop VMs with specific tags using a runbook you create. The drawback of this option is that you are forced to rely only on your Runbooks regarding your VM status, which may contain bugs and coding errors that prevent your virtual machines from operating correctly.

Cutting Azure costs by implementing auto-shutdown for VM using Turbo360

Turbo360’s Cost Analyzer is an Azure cost optimization tool that opens new possibilities for managing all your Azure expenses, creating optimization schedules to start, stop, and change the service tier of compatible resources during business hours, and monitoring your Azure budget for any spikes.

Cost Optimization is a crucial component integrated into Cost Analyzer that enables you to schedule your Azure services to run/stop (or) change the service tier during business and off-peak hours.

Cost Analyzer supports various Azure services for integrating with optimization schedules. The following Azure services are compatible integrating with optimization schedules:

  • App Service Plan
  • Cosmos SQL Container
  • Cosmos SQL Database
  • Cosmos Table
  • Data Factory Pipeline
  • Logic App
  • SQL Database
  • SQL Elastic Pool
  • Synapse Pipeline
  • Virtual Machines
  • Virtual Machine Scale Set

Let me showcase the potential savings on costs associated with scheduling VM Auto-shutdown using Turbo360’sTurbo360’s Cost Analyzer.

Assume your enterprise application uses over 500 VMs and is distributed across different Azure subscriptions. Shutting down all idle VMs is necessary to optimize your Azure expenditure.

To get insights into your Azure spending, you must create a cost management group with access to all your subscriptions.

In a cost management group, navigate the following path to create an optimization schedule for your preferred time zone: Optimization -> Schedules -> Add.

Auto-shutdown VMs by implementing Scheduling feature in Turbo360

The setup wizard presents a screen with options to fill in all the essential information, such as the schedule name, time zone selection, and a brief description that helps you quickly determine the schedule’s purpose.

Adding the VM optimization schedule

The next screen allows you to configure the time to stop the VM. Optimal business hours are usually between 8 a.m. and 5 p.m., regardless of different time zones.

Mark non-business hours in red for each day of the week. Estimated savings are the potential savings that can be achieved with the help of this configuration.

Add VM optimization schedule using Turbo360

You can select your virtual machine resources on the next screen to schedule Auto-shutdown. The resources are listed based on the subscription selection.

Set Start and Deallocate as the Up and Down configuration values, respectively. The Up and Down configuration values are applied based on the Up and Down hours specified in the schedule configuration.

Setting up VM scheduling

You can set up notification services to which the scheduling alert will be sent on the following screen. Various notification services are integrated with Turbo360, making it feasible for users to receive all their business notifications in one place without accessing the application.

The list of supported notification services includes:

  • ServiceNow
  • SMTP
  • PagerDuty
  • Microsoft Teams
  • Azure DevOps
  • Opsgenie
  • Operations Management Suite
  • WebHook
  • Twilio
  • Slack

VM scheduling notification channels

The schedule summary, which includes all pertinent information like the number of scheduled resources, potential cost savings, and configured notification services, is displayed on the final screen. To complete the schedule set up, click Create Optimization schedule.

Summary report of VM scheduling provided by Turbo360

You are all set! You will be notified through the notification services when the configured virtual machine resources are automatically stopped and restarted during scheduled downtime and uptime.

The critical benefits extracted from the above scenario when using Turbo360 over Azure are:

  • Several virtual machines can be scheduled to auto-shutdown and restart simultaneously.
  • The downtime and uptime can be scheduled for multiple virtual machines collectively or separately.
  • The potential cost savings achieved by automatically shutting down idle VMs using Optimization schedules are displayed right in front of you, facilitating the strategizing of your Azure spending.
  • You can also have insights on the cost savings when configuring the remaining virtual machines according to your schedule configuration.

To Summarize

With business organizations turning to cloud computing to manage all their applications and data, virtual machines are increasingly used. Since VMs account for a significant amount of Azure spending, shutting down unused VMs during non-productive hours is imperative because the spending could be more effective.

Control over your Azure expenses can only be achieved by implementing an automated process to shut down all idle VMs during off-peak hours.

Related reading

This article was originally published on Dec 20, 2023. It was most recently updated on Mar 6, 2024.

Related Articles