<img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=2923012&amp;fmt=gif">

Microsoft introduced Azure Budgets as a means to help companies plan for and drive organizational accountability. While many companies view budget enforcement from a traditional perspective such as alerts, currently Azure did not give you more direct options such as shutting down virtual machines (VMs). Using Budgets makes Azure cost management easy.

While these features are not out of the box, Azure Budgets does offer integration with Azure Action Groups. Action Groups provide a means to trigger an orchestrated set of actions resulting from a budget event. Such actions can be turning off machines when a threshold takes place (in this case when the budget is exceeded by a certain amount), for example. The action groups in term can then execute a PowerShell script (within an automation account) to perform the cost savings action.

It should be noted: this course of action does not need to be applied to all VMs. For example, the
shutdown sequence of VMs to keep within budget can be directed to machines:

  • Within a resource group
  • Those of specific tag
  • Those residing within a subscription

The scale of Azure cost management can be illustrated using a case studio defined in the image below. In this hypothetical organization noted in Image 1, the company tests and evaluates Azure VMs before launching them to their counterpart production resource groups. To partition costs and permissions, the company has siloed the efforts into two different subscription groups.

azure cost

Image 1

In this scenario, the company wants safeguards in place to prevent testing to go over budget from an Azure perspective. This is where an action group can be used by the company to perform counter measures when exceeding budgetary threshold as noted in Image 2 below.

azure alerts

Image 2

From here an automation account can be called runbooks gallery from the process automation section such as “Stop Azure V2 VMs”. As noted in the description, this PowerShell runbook is capable of findings and stopping all VMs in a subscription as shown in Image 3 below.

azure workflow

Image 3

To complete an orchestration process, Logic Apps should then be used. It has the means build
and schedule jobs in this case if a threshold was exceeded. In the Microsoft article “Manage
costs with Azure Budgets“ that was published in August 2020, Microsoft discusses this detail
using http triggers in Logic Apps to determine if the automation account should be triggered to
reduce costs.

The takeaway from this article is that Azure Budgets allow global admins to consider subscription layouts and measures which can be taken beyond traditional alerting to make Azure cost management easier and expenses down. In this example, a fictitious company is partitioned off production from the test environment using separate subscriptions. Because they are different subscriptions, a specific budget can be used in the test environment. An action group with a runbook can then be applied to take drastic actions, such as shutting down VMs in this case.

Free Ebook Download:
Costs and Benefits of Cloud Data Centers vs. On-Premise Data Centers

Today’s Data Centers Require Scalable Solutions. Download this eBook to learn about Microsoft Azure's cloud computing services.