0

In an attempt to call the RateCard API in Azure there is a need for several parameters that the typical Azure administrator will not have at hand easily. These include:

  • OfferDurableId
  • Currency
  • Locale
  • RegionInfo

If all we have is the subscriptionID, how do we programmatically get the above information so we can get the rate card for the subscription?

While Microsoft samples on GitHub (https://github.com/Azure-Samples/billing-dotnet-ratecard-api) demonstrate this using an app.config the reality is there is a lot of friction asking administrators to dig this up. There has to be a way to get this information without having to ask the admins all the time.

A typical URL to call the rate card API would be something like:

string url = $"https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/RateCard?api-version=2015-06-01-preview&$filter=OfferDurableId=\'{offerId}\' and Currency eq {currency} and Locale eq=\'{locale}\' and RegionInfo eq \'{regionInfo}\'";

Any ideas what APIs I can call to get this information from the subscription ID?

Dana Epp
  • 509
  • 1
  • 5
  • 13

1 Answers1

0

I think that except for the OfferDurableId parameter (which you can see the available values at Microsoft Azure Offer Details), the rest of the parameters should have a fixed value depending on the loction relevant to your organization.

For example, if your organization is located in the United States, then you would probably use:

  • Currency: USD

  • Locale: en-US

  • RegionsInfo: US

Update

Unfortunately, the API reference page states clearly to consult the Offer Details page to get the required ID:

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.

Regarding whether it will allow you to query using Currency/Locale/RegionInfo values not used by your subscription, I think it should be possible (to some extent at least), as your a just querying for general metadata.

Hope it helps!

Itay Podhajcer
  • 2,616
  • 2
  • 9
  • 14
  • Appreciate the response, but what I’m looking for is a way to do this programmatically. First off, unless we plan to try each offer detail individually until we find success we would be making lots of failed calls for each subscription. We are trying to do this so the admins using our software don’t have to look it up. Secondly while locale is to set the returned string values are you saying regardless of the region set we can force it? Ie: if the subscription was set in Canada and CAD dollars if I force it to to USD currency and US region it would convert it? I’d be surprised if that worked. – Dana Epp Dec 25 '18 at 05:39