Using the Azure Billing API with Powershell

Once you’ve got an Enterprise Agreement with Microsoft Azure, you’ll probably want to know how much you’re spending.

As with everything Azure, you’re better off forgetting the UI and using Powershell.

Unfortunately, the billing API doesn’t return detailed information in a Json or xml format – it is a long string delimited by commas and linebreaks.

Before we can do anything with the detailed data we get from the API we need to clean it up into a powershell object.  Once we have a usable object to work with then we can start playing with the billing data.

In the example below, I’ve used the sample data account (Enrollment #100), just plug in your own enrollment number and the access key from the Azure Enterprise Site and you’ll be away.
For full documentation on the EA API, you can find the API guide here

One Reply to “Using the Azure Billing API with Powershell”

  1. Hi Gordon, great post. Q – is there a way (using PS maybe) to get the enrollment information and the access key? I know i can get it from the EA portal, but wanted to know if there was a programmatic way of getting this info. Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *