Programmatic access to Azure usage data

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.

About Yossi Dahan
I work as a cloud solutions architect in the Azure team at Microsoft UK. I spend my days working with customers helping be successful in the cloud with Microsoft Azure.

3 Responses to Programmatic access to Azure usage data

  1. dei79 says:

    We built a cloud based solution to check your Azure spendings based on this API. You can find this service here: A couple more information and insights are available on my blog:

  2. Paul W says:

    Unfortunately (as mentioned), this documentation is only available to customers with Enterprise Agreement logins. The article taunts the rest of us with “The API is very simple”, and that there is a REST API that returns JSON (ideal to me), but… slaps my hands as I reach for it and says “No soup for you!”.

    What is the point of providing something for all to use then restricting the documentation behind a limited-access login?

    In fact, I’d argue this API is not available, and therefore unsuitable to be blogged about at this time. In the future, when it is made available to all Azure customers, it would be more helpful. Right now, this is just “there IS an API available, but it’s a secret and I’m not going to tell you.”

    The link and title looked promising but this blog post is effectively empty for regular Azure customers.

    • Yossi Dahan says:

      Paul – I appreciate that this does not help you if you do not have an enterprise agreement, but you should keep in mind that this is your own situation and that many customers do have access to the enterprise portal and therefore can benefit from this capability.

      It is not just the documentation that requires access to the enterprise portal, this capability is a feature of the enterprise portal and is not relevant to customers who procure Azure through the portal directly which is why the documentation is where it is.

      Again- I appreciate this is not relevant to you, but to declare that there is no API and that this post is ‘effectively empty’ is a very self centered point of view.

      I blog for both audiences (although arguably -mostly for myself!) and therefore I don’t see the problem with posting this personally. sorry if it left you disappointed.

      This is an area that will get improved further for both EA and non-EA customers so watch this space


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: