devxlogo

Explore New Microsoft Azure Billing APIs

Explore New Microsoft Azure Billing APIs

Yesterday, the Microsoft Azure team announced?the availability of the Azure Resource Usage and Rate Card API?that developers on the Azure platform can now leverage to programmatically retrieve usage and billing information. This feature will now allow enterprises in turn to charge their customers based on usage. This was long overdue for multi-tenant systems hosted on Azure and will allow accurate tracking of cloud spend and also make it more predictable to manage the cost of your operations on the cloud. Specifically, using the Billing API, there are two areas that you can query at your subscription level:

  1. Resource usage: The resource usage REST API allows you to get data consumption at a subscription level. The API acts as a resource provider as part of the Azure resource manager and you can use the role based access control features to allow/deny access to data. The URI you would call is the Usage Aggregates resource https://management.azure.com/subscriptions/{subscription-Id}/providers/Microsoft.Commerce/UsageAggregates. You need to pass the API version, report start and end date time. You need to also pass the granularity value as daily or hourly. What you will get back, amongst other things, is the usage start and end times representing the timestamp of the actual recorded usage, the meter category (storage or otherwise), meter subcategory representing if the storage is geo-redundant, and finally the quantity in units (typically GB). You can also send the show details flag as true in which case the response will also show the region and the project using the resource.
  2. Rate card: The rate card REST API allows you to fetch the pricing information by locale, currency, and region. The URI you would call is the Rate Card resource https://management.azure.com/subscriptions/{subscription-Id}/providers/Microsoft.Commerce/RateCard. The response will give you the meter rates (based on the currency specified in the input) for all the available meter categories like cloud services, networking, virtual machines, etc.

The API can be used against various scenarios such as finding the monthly spend, setup alerts if the usage varies against a specific threshold, and metering tenants based on usage.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist