Keeping the cost of your Azure infrastructure under control, is a vital need during every organization’s cloud journey. Therefore, Microsoft introduced the concept of budget alerts. Let’s have a closer look at the options this bring for your organization!
Create a budget
Azure budgets can be created on three levels:
- Management group
- Resource group
Next to that, you need to provide a name for the budget, a reset period (monthly/quarterly/annually) and start/end date. Most importantly, you need to configure the budget amount, of which a forecasted suggestion is calculated for you.
As a second step, you can set alerts. On several percentages of the budget, you can configure alerts. If you don’t specify a particular action group, an email is sent to the alert recipients. It’s a pity that a percentage higher than 100 is not allowed, as this might come in handy.
Configure action groups
The power is in the concept of action groups, similar to what’s being used in Azure Monitor alerts. This gives you extensibility points to activate the cost management measure of your choice. These are the options you have:
Because I’m quite a lover of serverless, my preference goes out to Azure Functions (typically using its PowerShell support) and Logic Apps (leveraging the rich connector experience). Next to that, the IT Service Management Connector option looks promising, but the reviews are not really encouraging. However, integrating with tools like ServiceNow can be easily done via Logic Apps, so you’re not limited by the boundaries of the ITSM solution.
What actions can we take if budget gets exceeded? Email alerting is one thing, but you can take it also to the next level. It’s important that the automated actions fit your company culture and that the level of governance is adapted to the type of workloads (development, R&D, demo, production…). Some ideas:
- Remove the Azure resources: this is a very strict measure you can take. Maybe, you can send first a confirmation mail, like I’ve done in my previous post. Or you can first automatically export the ARM template, as a kind of backup. Of course, this is not recommended at all for production workloads.
- Remove access to the Azure resources: with some PowerShell scripting, you can remove the owners from the access management. In that way, they need to request it again and access can be granted after some budget discussions.
- Downscale the Azure resources: loop through all resources within the scope and change their SKU to the free/developer tier. This is certainly possible, but a rather complex procedure, as the SKU change is depending on the resource type.
- Have a talk: sometimes a conversation about the budget can clarify a lot, so maybe you can launch some serverless automation to schedule a meeting with the owner of the budget, during a free spot in both of your agendas.
From a technical perspective, (almost) everything is possible. It’s important to think outside the box and adapt the budget alerts to the company culture and the type of workload. Don’t hesitate to share your experiences in the comments section! Always interested to learn how others deal with this!