New Azure Billing APIs Available

Organizations moving to the cloud can achieve significant cost savings.  But to achieve the maximum benefit you need to be able to accurately track your cloud spend in order to monitor and predict your costs. Enterprises need to be able to get detailed, granular consumption data and derive insights to effectively manage their cloud consumption.

I’m excited to announce the public preview release of two new Azure Billing APIs today: the Azure Usage API and Azure RateCard API which provide customers and partners programmatic access to their Azure consumption and pricing details:

Azure Usage API – A REST API that customers and partners can use to get their usage data for an Azure subscription. As part of this new Billing API we now correlate the usage/costs by the resource tags you can now set set on your Azure resources (for example: you could assign a tag “Department abc” or “Project X” to a VM or Database in order to better track spend on a resource and charge it back to an internal group within your company). To get more details, please read the MSDN page on the Usage API. Enterprise Agreement (EA) customers can also use this API to get a more granular view into their consumption data, and to complement what they get from the EA Billing CSV.

Azure RateCard API – A REST API that customers and partners can use to get the list of the available resources they can use, along with metadata and price information about them. To get more details, please read the MSDN page on the RateCard API.

You can start taking advantage of both of these APIs today.  You can write your own custom code that uses the APIs to construct your own custom reports, or alternatively you can also now take advantage of pre-built bill tracking systems provided by our partners which already integrate the APIs into their existing solutions.

Partner Solutions

Two of our Azure Billing partners (Cloudyn and Cloud Cruiser) have already integrated the new Billing APIs into their products:

Cloudyn has integrated with Azure Billing APIs to provide IT financial management insights on cost optimization. You can read more about their integration experience in Microsoft Azure Billing APIs enable Cloudyn to Provide ITFM for Customers.

Cloud Cruiser has integrated with the Azure RateCard API to provide an estimate of what it would cost the customer to run the same workloads on Azure. They are also working on integrating with the Azure Usage API to provide insights based on the Azure consumption. You can read more about their integration in Cloud Cruiser and Microsoft Azure Billing API Integration.

You can adopt one or both of the above solutions immediately and use them to better track your Azure bill without having to write a single line of code.

image

Cloudyn's integration enables you to view and query the breakdown of Azure usage by resource tags (e.g. “Dev/Test”, “Department abc”, “Project X”):

image

Cloudyn's integration showing trend of estimated charges over time:

image

Cloud Cruiser's integration to show estimated cost of running workload on Azure:  

image

Using the Billing APIs directly

You can also use the new Billing APIs directly to write your own custom reports and billing tracking logic.  To get started with the APIs, you can leverage the code samples on Github.

The Billing APIs leverage the new Azure Resource Manager and use Azure Active Directory for Authentication and follow the Azure Role-based access control policies.  The code samples we’ve published show a variety of common scenarios and how to integrate this logic end to end.

Summary

The new Azure Billing APIs make it much easier to track your bill and save money.

As always, please reach out to us on the Azure Feedback forum and through the Azure MSDN forum.

Hope this helps,

Scott

15 Comments

  • Awesome! Been waiting for these for a while!

  • Yay. No more downloading and parsing csv files!

  • The tags are a lie! According to the linked MSDN page they are still "in a state of transition".

  • Hi BenV. Once you create tagged resources (Compute/Networking/Storage) through the Azure Resource Manager, these tags will flow to the usage details in the billing portal. For more information on creating resources through the Azure Resource Manager, please check out this blog: http://azure.microsoft.com/blog/2015/04/29/iaas-just-got-easier-again/.

  • This functionality is actually very useful. Been waiting for this!

  • I'm not able getting the usage data aggregate by hour. when I set the parameter it is still aggregated by day as far as I can see.

  • Has anyone been able to get the Billing API to work using PowerShell?

    I was able to get Usage data following code here:
    http://blogs.technet.com/b/keithmayer/archive/2015/06/28/export-azure-subscription-usage-with-new-billing-api-and-powershell.aspx

    However, transcribing what should be simple changes to get Billing working do not appear to work.
    I appear to only need to change the $uri variable to something similar to what is shown here:
    https://msdn.microsoft.com/en-us/library/azure/mt219004.aspx

  • @Filip, using the instructions and code in the keithmayer blog, I was able to get usage hourly as well as daily.

  • @Edward Shen - can you elaborate what isn't working for you? Thanks for posting the Keith Mayer blog link - much appreciated.

  • No problem - that link helped me a lot.

    The Usage API is working for me, but the RateCard is not.

    I basically follow the syntax advice given here: https://msdn.microsoft.com/en-us/library/azure/mt219004.aspx

    I mostly just change the $uri variable from Keith's Usage API example, and I get an error stating that I have an invalid query expression.

    The URI supplied is as follows (I hard coded a bit for testing purposes):
    $uri = "https://management.azure.com/subscriptions/$subscriptionId/providers/Microsoft.Commerce/RateCard?api-version=2015-06-01-preview&`$filter=OfferDurableId eq ’MS-AZR-0023P' and Currency eq ’USD’ and Locale eq ’en-US’ and RegionInfo eq ’US’"

  • Thanks for this API, I was really in need of this!

  • is there a limitation of using the Rate Card API with EA offers ? Also any idea when these API's will be available for Azure GOV ?

  • Hi Filip

    Can you please pass us the url (query parameters) you are sending? We'd like to help you debug the situation

    thanks

  • @Edward Shen - here are a few followups:

    1) Usage API now has a powershell commandlet that you can leverage - get-UsageAggregates

    Switch-AzureMode -Name AzureResourceManager

    Add-AzureAccount

    Select-AzureSubscription "YOUR-AZURE-SUB-NAME"

    $agggregate = get-UsageAggregates -ReportedStartTime "5/2/2015" -ReportedEndTime "5/5/2015"
    $agggregate

    2) RateCard API question - you are adding an extra ' in your query near filter:

    A sample query that does work looks like this: "https://management.azure.com/subscriptions/$subscriptionId/providers/Microsoft.Commerce/RateCard?api-version=2015-06-01-preview&$filter=OfferDurableId eq 'MS-AZR-0062P' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq 'US'"

    Can you see if that works for you?


  • @Anand Kumar R - currently, the RateCard API does not provide rates for EA offers. This API should also work for govt Azure subscriptions, so please send me an email on mobandyo@microsoft.com if you are facing issues with this.

Comments have been disabled for this content.