Programmatic access to Azure usage data
August 26, 2014 3 Comments
An exciting announcement, on a boring sort of topic, landed on my mailbox just now – finally the Azure usage details, so far only available as a download through the Azure Enterprise Portal, has been made available via a REST API (its documentation is available here although somewhat unfortunately this requires access rights to the portal)
The API is very simple, and at this point only allows retrieving the list of available months as a JSON document, the usage summary for selected month, also as a JSON document and the detailed usage for a selected month as a CSV file.
Sure – this could be improved on, but it is the most basic functionality that so many customers have been asking for – the ability to programmatically, and therefore regularly, download the usage reports so that they can be reported on (and, where necessary, actioned on)
The documentation include sample code in C# and powershell which is very clear and ‘just works’, so there’s no point me repeating it here. it is a simple case of submitting an HTTP Request to a properly constructed URL and adding a bearer HTTP token with an access key generated through the EA portal itself and processing the JSON or CSV result, depending on the request issued.
I can see most organisations building either an SSIS job or similar, that downloads the data daily (it refreshes every 24 hours) and loads it into a database from which reports and alerts can be driven using existing BI capabilities or simply downloading the CSV file and storing it in a central location such as a SharePoint library to be analysed by Excel and PowerView.
Eitherway – having programmatic access to this data in a way that allows plugging it in to exiting BI practices is a powerfull thing and a well sought after capability.