Yesterday Microsoft announced that an internal project to improve visibility into Azure usage stats has been open sourced and is now available on GitHub. Once deployed, customers should be able to register any subscriptions that is being used by an organization with the usage being polled on a daily basis. Usage and billed amount will displayed in a configurable Power BI dashboard:
The Azure Usage and Billing Portal consists of multiple pieces:
- Registration website for providing the system access to Azure subscriptions
- Dashboard website for reviewing the subscriptions that have granted access, viewing the state of job requests, and starting unscheduled jobs to pull usage data
- SQL Database for storing usage and billing data
- Storage Queue for storing requests to pull data from the Usage and RateCard APIs
- Scheduled webjob to trigger a daily pull request for each subscription
- Continuous webjob to pull data whenever a request enters the Queue
- Power BI Dashboard to display the results
You can follow along with step-by-step instructions to generate those resources, update the necessary configuration files in Visual Studio, and deploy all of your projects into Azure.
If you’d like to understand more about how the project was built, you can review the following resources on Azure portal:
- The Azure Billing REST API Reference provides details of the two APIs used to pull usage and RateCard information.
- The Azure Billing API Code Samples contain examples of using those APIs.
- Of particular importance is the Multi-Tenant Web Application sample which demonstrates how the consent process for the Registration website works.