Automating Azure Virtual Machines (VMs) – Start-Stop Scheduling

Lately, have you been draining money on your idle Azure resources and virtual machines? You are not the only one.

It has been observed that idle VMs or resources in the non-production state are not utilized 24✕7, but keep running unnecessarily. Approximately 44% of compute spend gets wasted on non-production, idle resources. Following are some data on wasted cloud spending due to idle resources estimated in 2020 and 2021:

Data on wasted spending from idle resources shows that “$33.3 billion in compute spend, times 0.44 non-production, times 0.76 of week idle, equals to $11 billion wasted on idle cloud resources in 2020.”

A similar study estimated that “up to $14.5 billion were likely to be wasted on idle resources in the year 2021.”

Leaving your Azure VMs running beyond the work hours and utilization, especially when you have purchased them on-demand, gets very expensive and racks up costs rapidly. So, the right thing to do is to shut down or pause your virtual machines when not in use.

But, it is not always possible to stop and restart all your VMs manually, particularly during weekends or on public holidays. Therefore, leveraging Azure Automation to automate the start/stop schedule of VMs is an efficient solution to wasted cloud spending.

This blog will help you understand the benefits of automation to start and stop your Azure virtual machines when they are not being used or are in an idle state.

Why is it important to schedule the start and stop time of Azure VMs?

Cost optimization is one of the essential tenets of businesses operating on cloud as they aim to make the most out of it. Automation is now a necessary piece of cloud cost optimization and governance. It helps reduce the number of idle virtual machines running in Azure during off-hours, for example, on weekends or overnight when no developers or other IT resources are working.

Optimizing the utilization of resources based on project and business needs enables you to keep the entire Azure inventory under control, helps reduce wasted cloud spending, and drives significant cost savings on your overall Azure bill/invoice.

However, the benefits of auto-scheduling are not limited to cost optimization or governance. Automating the startup and shutdown of your Azure resources or VMs also increases the efficiency factor of your IT and engineering teams as they don’t have to waste their time on redundant and mundane tasks.

Automating your virtual machines’ start-stop schedules in Azure

You can automate the shutdown and startup cycle of your existing VMs using any pre-existing or creating a new Automation account in Azure and linking an existing Log Analytics workspace.

For auto-scheduling your VMs in Azure during non-production hours, you will need the following services:

  • Automation – to start and stop the enabled virtual machines on user-defined schedules,
  • Log Analytics Workspace ​​– to analyze and gain insights into the start/stop scheduling of VMs, ensuring the automation process is successful, and
  • Azure Monitor ​​– to configure email notifications or set alerts for getting notified about the change in the VM state.

Azure lets you enable and configure the “Start/Stop” schedules of virtual machines for the following scenarios or use cases:

  1. Start/Stop Azure VMs for a specific schedule
  2. Start/Stop VMs in sequence using tags
  3. Automated startup & shutdown of Azure Virtual Machines based on CPU utilization

You can define and set up multiple auto-schedules for your VMs using Azure tags and their metadata in the Azure Portal or with the help of PowerShell. The “Start/Stop VMs during off-hours” feature in Azure starts/restarts virtual machines using the Start-AzVm cmdlet and shuts down VMs using the Stop-AzVM cmdlet.

In our next detailed, step-by-step guide, we will explain how to automate the startup and shutdown of VMs in Azure for each scenario mentioned above.

Simplifying auto start and auto shutdown of Azure Virtual Machines

Although Azure cloud allows you to configure and enable the automated start & shutdown (pause-unpause) feature for scheduling VMs, you need an IT team or some kind of technical support in place to implement this feature and manage the VM scheduling. Let’s say you want your virtual machines to run during the weekends for a particular project; you will have to:

  • create a separate Automation account,
  • define specific variables,
  • configure the schedules (start or stop) for target VMs, and so on…

Such complex activities and pre-requisites make the entire process a little more tricky to set up and manage unless you have dedicated IT resources working on this.

Therefore, you can choose to take the challenging route where you have to schedule the Azure VMs manually, or you can plug in an automated cost optimization platform like CloudMonitor and streamline the run-schedule of virtual machines with a few clicks.

Automating Azure VM Start-Stop Schedules
Automated Schedules of Azure VMs and Workloads on CloudMonitor

You can create custom schedules for your workloads and VMs, and CloudMonitor’s automated scheduling system will pause and restart them based on the schedule rules defined. In addition, its intelligent cost optimization feature enables you to shut down idle VMs during public holidays, weekends, late-night hours, etc., and saves dollars that you have been otherwise burning on non-production resources.

Try out the CloudMonitor platform for yourself to unlock the real value addition to your Azure Cloud.

Rodney Joyce

Subscribed! We'll let you know when we have new blogs and events...