Search code examples
azurehttp-status-code-400azure-billing-api

How to get data from Azure usage API in a currency different from the region's currency?


I am trying to fetch rate card data for the usage information for my PAY-AS-YOU-GO Azure account using the following API:

https://management.azure.com/subscriptions/<subscription_id>/providers/Microsoft.Commerce/RateCard?api-version=2015-06-01-preview&$filter=OfferDurableId+eq+'MS-AZR-0003P'+and+Currency+eq+'USD'+and+Locale+eq+'en-US'+and+RegionInfo+eq+'IN'

And I get the expected rate card data. However, when I change the currency to something like GBP, I get a 400/Bad request as response.

Any idea if I can get the response in any desired currency? If yes, then how? If no, is there a documentation which will help me in identifying which currencies are permissible in the request for a particular region?


Solution

  • I don't think you can do this (and that's why you're getting a 400 error). If you look at the error details, you will see something like below:

    Invalid region info:in and currency code:GBP combination specified

    If you want to get the rate card information in other currencies, you would need to ensure that proper combination of currency code and region is specified. For example if you try GBP and GB for currency and country code respectively, you will get desired reults.