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?