简体   繁体   中英

Azure Billing API returns nothing

I want to read current charges of my Azure Subscription programmatically. I currently use the sources from Microsofts GitHub samples .

I added an application to my AAD and gave it all permissions on 2 areas:

权限

I configured my subscription id and the client id of the app. When I try to get the charges with the following url:

https://management.azure.com/subscriptions/{Subscription-ID}/providers/Microsoft.Commerce/UsageAggregates?api-version=2015-06-01-preview&reportedstartTime=2015-07-01+00%3a00%3a00Z&reportedEndTime=2015-08-31+00%3a00%3a00Z

This link queries 2 months but returns nothing. My Azure portal gives me current charges.

Aah...I should have seen it sooner. I just realized that you're fetching data for last year. Billing and Usage data is only kept for last 3 months (90 days to be precise) and because of this you're not getting any data back.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM