Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Azure offer details using the API?

I was trying to query the usage and billing API that Azure recently recently and saw that I can use the following API to get the rate card:

https://management.azure.com/subscriptions/{subscription-id}/providers/Microsoft.Commerce/RateCard?api-version=2015-06-01-preview&$filter=OfferDurableId eq '{offer-id}' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq 'US'

However, this requires I need to explicity know the offerDurableId, which I came to know for my case from Azure's website.

Is there an API that will give me these offer codes?

like image 574
jobin Avatar asked Oct 20 '22 04:10

jobin


1 Answers

AFAIK, there is no API to get the offer codes. In fact if you look at Billing API documentation here, they also ask you to get the information about this from the link you mentioned.

Set {OfferDurableId} to a valid Offer ID code (e.g., MS-AZR-0026P). See Microsoft Azure Offer Details for more information on the list of available Offer IDs, country/region availability, and billing currency. The Offer ID parameter consists of the “MS-AZR-“ prefix, plus the Offer ID number.

Considering the offer code don't change, I think it is somewhat safe to save this information in your own database

like image 156
Gaurav Mantri Avatar answered Nov 15 '22 06:11

Gaurav Mantri