Let me first introduce you to Azure Cost Management, it’s a SaaS solution that empowers you to monitor, allocate, and optimize cloud spend in a multi-cloud environment and the best part of all that is… it is FREE! 😊
Maybe you are still asking yourself: why should I use Azure Cost Management?
With this powerful solution you will have the necessary tools to get more visibility, accountability and optimization. It will also give you the autonomy and the awareness around what your company or client is spending in Azure and whether or not they’re spending it judiciously.
If you are new to Azure and you’re a little bit worried about your incoming invoice or you are a manager and your team is using Azure, you’d like to analyse the cost because you have a budget that the finance department gave you this year, so here I will show you step by step what to do to analyze your cost, create a budget and set alerts to keep your cost under control.
Imagine that you have a budget of 120 euros per month to spend on your cloud, and you are worried to exceed that amount and if that happens you want to be able to react somehow, like receiving an email alert about it and possibly an SMS. We also need to analyze what is consuming a lot of money, and based on that we can take some actions.
So here is our to do list:
- Analyze our costs.
- Create a budget of 120 euros per month.
- Create an alert which sends an email and a SMS when it reaches our budget.
1 . Access the portal and analyze your cost.
The Cost Management tools are accessible from a variety of locations in the Azure portal:
-Left side you will find Cost Management + Billing or you can type in the search bar.
-Click on Cost management and hit Cost analysis.
Here it is important that you check what the current scope is and if you need to change you can click on it and select the scope that you want. Access to a subscription requires at least the Cost Management Reader (or Reader) permission. You can configure permissions of a subscription in the Azure portal. To do that, you must have at least the User Access Administrator (or Owner) permission for the subscription to enable access for others.
You are watching now your expenses for the current period. The chart above is of the utmost importance because it is the Accumulated cost.
-There are 6 built-in views, you can check the view drop down (you can find next to the scope) and you will see the other views: cost by resource, daily costs, cost by service, invoice details.
-On the main chart there are 2 colors, a dark green that is the accumulated cost and the light green which is the forecast.
-You also have 3 pivot charts by default: service name, location and resource group, that show you the largest to the smallest expense of the month. You can also change the 3 panels as you like. Check the drop down and select the one of your preference.
Additionally, you will see:
-The Actual cost: it’s the amount of the total usage and purchase costs of the month.
-The Forescast: it shows the total forescast cost for the period that you choose.
-Budget: It shows planned spending limit for the select scope.
-Also, you can Group by the view, for example if you want to see your spending by resource, you group by resources and can choose the Granularity between accumulated, daily or monthly.
So far, we saw what is going on with the resources and how much it is costing us, but now we need to react to what is happening. So..
2 . Let’s set our budget and our alerts!
At the left side of your portal click Budgets and then click on Add (again don’t forget to check the scope)
- Name your Budget.
- Set the Reset period to billing month. (we said that we can’t exceed 120 euros per month).
- Set the Expiration date: How long you want the budget runs.
- Set your Budget Amount to 120 euros and click Next.
When you set your budget, you can set up your alerts.
So, the first question that you have to ask yourself to set the alert condition is…
How do you want to react when it reaches your budget or before it reaches it?
We said that we want to receive an email and also send an email to the devOps teams when it reaches our budget. Besides that, we want an SMS notifying us.
- Configure the Alert condition to 100 %. In case you just want to receive an email, you can just type your email address in the Alerts recipients (email) section, but, we said that we want to receive an email, also a notification on your phone and send an email to the devOps teams, that’s why we need to configure the Action group.
The action group can perform various actions when your budget threshold is met. Action Groups are currently only supported for subscription and resource group scopes.
- Click below Manage Action group and then add action group.
- Configure the Subscription and the Resource group.
- Set the Action group name.
- Set the Display name. The display name is used instead of a full action group name when notifications are sent using this group.
- Click Next:Notifications.
- Set the Notification type you want to send:
–Email Azure Resource Manage Role and put a name. (Send an email to users assigned to certain subscription-level ARM roles)
–Email/SMS/Push/Voice (Send these notification types to specific recipients.)
- Details: Based on the selected notification type, enter an email address, phone number, etc.
- You can also set some actions like calling an Azure function, Automation Runbook, Azure Function, ITSM, Logic App, Secure Webhook, Webhook. For this demo we just want the notifications by email and SMS.
- You can also put some Tags. This lets you associate key/value pairs to the action group for your categorization and is a feature available for any Azure resource. For this demo we don’t have tags.
- Click Review and Create.
When it’s done, we go back to budget section, set the Action Group that you created and click Create.
After seconds your configuration of budget and alert will be created and you won’t have to worry anymore about exceeding your quota 😊.
You can find many other additional features, for example:
- Pin your view to a dashboard for quick access.
- Offline Analysis.
- Export and configure a daily export as an image, csv file, excel file.
I leave you this link so you can explore a little more about Azure Cost Management and I hope you are ready to understand now how your costs can accumulate each month, and that now, you can manage this better.