Are the Azure usage and rate card APIs supported for US GOV EA subscriptions?

546 views Asked by At

I have a client with a Azure subscription sitting in a US GOV data center. This subscription is under an EA (not pay-as-you-go).

Attempting to use the standard billing APIs (ratecard and usage) fails with a 'Subscription not found' error. I.e. running the following:

https://management.azure.com/subscriptions/[subscription id here]/providers/Microsoft.Commerce/RateCard?api-version=2015-06-01-preview&$filter=OfferDurableId eq 'MS-AZR-USGOV-0017P' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq 'US'

fails with:

{
    "error": {
        "code": "SubscriptionNotFound",
        "message": "The subscription '[subscription id here]' could not be found."
    }
}

I've found very little information on the rate card and usage APIs with EA accounts and even less information on these APIs for accounts running in a US GOV Azure region. Does anyone know if this is supposed to work?

2

There are 2 answers

2
Brian Nielsen On BEST ANSWER

I don't have any experience with the Gov environment, but otherwise my experience is that Resource Usage API also works for EA, whereas the RateCard does not. I would suggest you to start out with the powershell cmdlets for an easy start * Get-AzureRmUsage https://learn.microsoft.com/en-us/powershell/resourcemanager/azurerm.insights/v2.3.0/get-azurermusage

Be sure that you have powershell running correctly towards the Government environment first. If you want to roll your own client remember to use the correct endpoints as described in "Azure Government developer guide" https://learn.microsoft.com/en-us/azure/azure-government-developer-guide

Brgds Brian

0
vinnielima On

For EA offer IDs, you need to use the following API:

https://consumption.azure.com/v2/enrollments/(enrollment_id)/pricesheet

You will need to provide EA API Key (different than bearer token from other APIs):

curl -X GET https://consumption.azure.com/v2/enrollments/(enrollment_id)/pricesheet -H 'authorization: Bearer (api_key)'

Note that the API bearer token needs to be created in the EA Portal under the User Account. More detail can be found here: https://learn.microsoft.com/en-us/azure/billing/billing-enterprise-api

Also note that the user must have appropriate privileges otherwise the API will reject your request.