简体   繁体   中英

How to get total billing amount with azure billing API

I have to display total billing amount for a Azure subscription. Currently I am using Resource Usage API (Preview) and Resource RateCard API(Preview) which is giving me very large detailed data for Rate for each meter and its usage. As per this article, I've to multiply Rate card details with the Usage Details.

As in my case, I've to show only total billing amount lets say 500 USD, its more than what I required and includes lot of manual work.

Is there any simple way to directly request total amount.

Calling Usage API:

string requesturl = String.Format("https://management.azure.com/subscriptions/{0}/providers/Microsoft.Commerce/UsageAggregates?api-version=2015-06-01-preview&reportedstartTime=2015-05-15+00%3a00%3a00Z&reportedEndTime=2015-05-16+00%3a00%3a00Z", subscriptionI d);

Calling RateCard API:

string requesturl = String.Format("{0}/{1}/{2}/{3}",


"https://management.azure.com",
                   "subscriptions",
                   subscriptionId,
                   "providers/Microsoft.Commerce/RateCard?api-version=2015-06-01-preview&$filter=OfferDurableId eq 'MS-AZR-0121p' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq 'US'");

Saurabh - unfortunately, we don't have an API that gives you the outstanding bill / running total of open billing period, but the combination of Usage and RateCard API can get you close.

We are actively discussing this scenario, but you might also want to reach out to 2 partners who have done the integration with the 2 Azure Billing APIs, that might be interested in building out the "get outstanding bill" API - Cloudyn and Cloud Cruiser.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM