Skip main navigation

Cost Tracking and Optimisation


During this course, we’ve explored and worked with Infrastructure as Code and Automation. In reality, it’s so easy to lose track of your spend within your environments.

Keeping track of the resources being consumed and optimising your environments can become messy when you create and provision machines as you need them, and trash them when you don’t need them.

In this step, we’ll discover how Azure Advisor can help you optimise your environment by checking your resource consumption and giving you feedback. We will also look at Auto-Shutdowns and AutoStart for Virtual Machines to minimise waste and control costs.

Optimisation with Azure Advisor

Your resource configurations and usage telemetry can be analysed to optimise Azure deployments with Azure Advisor. Advisor acts as a consultant to recommend best practices to improve cost-effectiveness, high availability, and security of your resources.

You can access Advisor through the Azure portal by selecting Browse, and then scrolling to Azure Advisor. The Advisor dashboard will show personalised recommendations for a selected subscription, which are divided into the following four categories:

  • High availability, to ensure and improve continuity of business-critical applications.
  • Security, to detect threats and vulnerabilities that could lead to potential security breaches.
  • Performance, to enhance the speed of your applications.
  • Cost, to optimise and reduce overall expenditures.

Auto-Shutdowns for VMs

To minimise waste and control costs, virtual machine (VM) auto-shutdown is available to all Azure Resource Manager-based Azure VMs and to VMs in Azure DevTest Labs.

After you have created them in DevTest Labs, the reusable templates can be used everywhere. To set this feature:

  • Go to your VM blade in Azure portal.
  • Select Auto-shutdown in the resource menu on the left side.
  • You will see an expanded auto-shutdown settings page where you can specify the auto-shutdown time and time zone. You can also configure to send a notification to your webhook URL 15 minutes before auto-shutdown.

You can now configure auto-shutdown for a single lab VM in addition to the auto-shutdown policy that applies to all the lab VMs.

VM AutoStart on DevTest Labs

In addition to scheduling automatic shutdown for the VMs in a lab, you can use Azure DevTest Labs to automatically start selected VMs at the scheduled time. Along with setting the time, you can set the days of the week for the auto-start.

The auto-start policy requires you to explicitly select a VM and apply the policy from its context menu after you enable the policy. That way, you won’t easily run into the situation where unwanted VMs are accidentally auto-started and cause unexpected spending.

Start/Stop VMs During Off Hours

In Azure Automation, a new feature has been released to Preview that starts and stops Azure Resource Manager virtual machines on a user-defined schedule and also provides insight into the success of the Automation jobs that start and stop VMs with OMS Log Analytics. To configure the solution in your Automation account, see the Solution Components and Configuration.

Once added, a StartStopVM View tile will be added to your OMS dashboard to show how many runbook jobs have started and completed successfully:

In your Automation account you can access and manage the solution by selecting the Solutions tile and then the Start-Stop-VM[Workspace] solution from the list:

Here you can look at important details along with the StartStopVM tile and you can also open your OMS workspace and perform further analysis of the job records by selecting All settings > Quick Start > OMS Portal.

Join the discussion

Do you currently track costs and optimise your environments? How do you track costs? How do you optimise your environments?

Use the Discussion section below and let us know your thoughts. Try to respond to at least one other post and once you’re happy with your contribution, click the Mark as complete button to move on to the next step.

This article is from the free online

Microsoft Future Ready: DevOps Development, Implementation and Azure Automation

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now