Latest posts by Paul Schnackenburg (see all)
- Burstable VMs (B-series) in Azure - Tue, Dec 12 2017
- Project Honolulu - A new way to manage Windows Server - Wed, Nov 22 2017
- Use Azure Managed Service Identity (MSI) to store passwords in your code securely - Thu, Nov 9 2017
In general, you can find the billing information for a single subscription here, and a little while ago Microsoft released the Azure Resource Usage and RateCard APIs. These APIs make it easy to see rates and usage information that you can integrate into your own custom solutions programmatically. The APIs are also useful for third-party solutions such as Cloudyn and Cloud Cruiser.
But I suspect the vast majority of Azure users won’t want to develop their own solutions—nor are they necessarily keen on third-party services just to keep track of usage and spending.
This information should, of course, be part of the portal and (given the right permissions) be readily available, but that isn’t the situation today. However, a few developers within Microsoft have created a free open-source solution called the Azure Usage and Billing Portal, which we’ll look at in this article.
You set up and configure this solution in Azure, which relies on a website for registering your subscriptions, a dashboard for displaying the information from the subscriptions, an SQL database for storing the data, a storage queue for pulling data from the APIs, and a Power BI dashboard to show the data. In case it’s not clear, some parts of this solution will have a small ongoing monthly cost. In other words, you’re paying to have a way to track costs across Azure subscriptions.
There’s a script, which is part of the download on the github page, to create all the necessary parts. You’ll need to customize this script with a subscription name and other variables; step-by-step instructions are available here.
I need to put in a warning here. Setting up this solution is not for the newbie IT pro. There are many steps to get to a working solution; some of them involve customizing the PowerShell script; others involve editing code and deploying solutions from Visual Studio.
In the end though, you do get a powerful Power BI dashboard with visualizations and graphs to keep track of your usage across all Azure services.
I’m not going to repeat each step of the process from the video, but having gone through the process and got it working (in the end), I’ll offer some tips for a successful deployment. In Step 3, pick a subscription that’s going to house the components for the solution. When you customize the PowerShell script in Step 4, you define an “alias,” which is going to be included in the name of various components. Make sure you don’t include a number or capitals (I used 4Sysops the first time), as one of the components is a storage account—it won’t accept anything but lowercase strings without numbers. The script does not validate your input.
Once you have the websites up and running in Step 10, open an InPrivate/Incognito browser window to the registration website and enable monitoring for each subscription:
In the final step (11), you customize the Power BI dashboard and can publish it for consumption from the web. The dashboard lets you select different subscriptions, services categories and subcategories, as well as the date range. I was able to look back over two years of cumulative Azure usage.
The web-based dashboard is a useful way to share information with other people in your organization:
The announcement page of this solution contains a lot of comments by people; they can be summarized as, “Don’t make us jump through (difficult) hoops; this should be part of the portal already.” I tend to agree, although I also think the developers who put together the solution aren’t really at fault—at least they’ve tried to do something about the problem.
Getting this up and running was a challenge, but the resulting dashboard is very comprehensive and gave me some unexpected insights into where the dollars go.
What this solution has taught me (apart from how to use Visual Studio a little bit) is that creating complex solutions for Azure isn’t as simple as the mantra “just use an ARM template” can lead you to believe. In this case, for instance, there are configuration changes to make to published web applications in Azure AD, which ARM doesn’t support yet.
If all you’re looking for is a quick way to get an overview of usage across subscriptions, this solution isn’t for you. If, on the other hand, you’re up for learning how multiple services work together in Azure and how to customize code in Visual Studio and dashboards in Power BI—this free solution is just the ticket.