I need to get Usage Details at Billing Account Scope for that firstly I used this API but It returns an empty value. I used the Bearer Access token for hitting this API.Is anything other than this am I missed?
Not able to get Azure Billing Account Id
1.8k Views Asked by DAK At
2
There are 2 best solutions below
10

I believe you're using the wrong API. To get Billing info you must provide billing account name:
GET https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}?api-version=2019-10-01-preview
https://learn.microsoft.com/en-us/rest/api/billing/2019-10-01-preview/billingaccounts/get
PS: you can use the "try it" and test if it will return the information you need.
You can also query usage API and use one of the available dimensions to get cost related info:
POST https://management.azure.com/{scope}/providers/Microsoft.CostManagement/query?api-version=2019-11-01
https://learn.microsoft.com/en-us/rest/api/cost-management/query/usage
This api will return a value if account belongs to Modern billing