Skip to content
Mike Evans-Larah By Mike Evans-Larah Software Engineer III
How we set up daily Azure spending alerts and saved $10k

One of the great benefits of Azure (and the Cloud in general) is the simplicity with which you can create and scale resources. The downside to this is that you can easily lose track what you've got deployed, or accidentally create expensive items and leave them running.

We wanted a way to track our spending on a daily basis so we could keep tabs and detect any unusual spikes in costs. Previously, we were relying on Azure billing but this meant that costly resources could have been running for up to 2 months before we were notified.

Fortunately, Microsoft recently added the Azure Cost Management service (by Cloudyn). This is a free service which updates daily with reports detailing the breakdown of your assets and costs in Azure.

To set it up, go to the Azure Portal, select 'Cost Management + Billing' -> 'Cost Management' -> 'Go to Cost Management'.

Cost Management Portal

This will open up the Cloudyn site in a new tab, and from here you can configure the service to monitor your subscriptions.

Cloudyn setup

There are slightly different steps depending on how your subscriptions are managed - the Azure documentation page has quick step guides for each subscription type: individual subscription owner, EA, and CSP.

N.B. If you have Microsoft Sponsorship subscriptions like we did, follow the steps for 'individual subscription owner' and select the 'MS-AZR-0003P - Pay-As-You-Go' offer ID - this will show you what your spend would be if it were not discounted.

Azure Weekly is a summary of the week's top Microsoft Azure news from AI to Availability Zones. Keep on top of all the latest Azure developments!

As part of the setup you will need to grant access to Cloudyn to read your resources and billing information. Once this is done, the service will start gathering data about your assets and costs. The documentation suggests that it can take up to 24 hours for the first data to appear - in practice, we found we actually had to wait around 48 hours, so don't despair if nothing happens straight away.

When you have data flowing, you can generate all sorts of reports related to your costs, drilling down into specifics like service providers and resource types. The one we were particularly interested in was the rolling total of spend over the last 30 days, with costs broken down by day. This allows us to spot anomalies and general spending trends before they get out of control.

Cost by datetime The graph above is an example of the report showing cost by day over the last 30 days. It is annotated to show our analysis of the anomalies (we used Cloudyn again to drill into the cost breakdown for each day, and to determine where we could make the biggest costs savings).

Once you have configured any report, you can set up a schedule for it to be emailed out on a daily, weekly, or monthly basis, so you don't have to remember to come back to the dashboard all the time.

With the help of Cloudyn, we were able to reduce our projected Azure spend for the year by $10,000.

BONUS - Configuring alerts in Slack

We spend a lot of time in Slack at endjin, and it has become our central place for alerts across all sorts of things, from CI/CD notifications, to whether our security cameras are working. So whilst email alerts for Azure costs are good, Slack alerts would be better.

The best hour you can spend to refine your own data strategy and leverage the latest capabilities on Azure to accelerate your road map.

Now Cloudyn doesn't have any native support for Slack or webhooks, but what we did make use of was Slack's email integration. With the Slack Email app, you can create an email address which will forward all emails sent to that address to the Slack channel of your choosing. You can even customize the name and avatar that gets used when posting the message.

Slack setup

We simply configured Cloudyn to send out the report to a Slack email address we generated, and now we have a daily report in our #azure channel alerting us to our spending trends in Azure.

Slack alert

Mike Evans-Larah

Software Engineer III

Mike Evans-Larah

Mike is a Software Engineer at endjin with over a decade of experience in solving business problems with technology. He has worked on a wide range of projects for clients across industries such as financial services, recruitment, and retail, with a strong focus on Azure technologies.