2
votes

I am querying Azure Consumption REST API using postman. properties/usageEnd (Utc time), properties/usageStart (Utc time) filter is not working

Tried below options:

https://management.azure.com/subscriptions/xxxxxxxxxxxx/providers/Microsoft.Consumption/usageDetails?api-version=2019-01-01&filter=properties/usageStart eq \'2019-02-01T00:00:00Z\' and properties/usageEnd eq \'2019-02-14T00:00:00Z\'

usageStart eq '2018-04-01' AND usageEnd eq '2018-05-30'

properties/usageStart eq '2019-02-01T00:00:00Z' and properties/usageEnd eq '2019-02-14T00:00:00Z'

usageStart eq 17/10/2018 15:18:06 and usageEnd eq 17/10/2018 16:18:06

I am actually for date filter for this API and it is not working.

2
It seems to "work" when you request very recent information, like the usage from the past week or so. When I go further in the past, I get very random results.Fabien
Hi Nithin, try using &$filter instead of &filterFabien

2 Answers

1
votes

It works perfectly for me.

https://management.azure.azure.com/subscriptions/{SubscriptionGuid}/providers/Microsoft.Consumption/usageDetails?api-version=2019-01-01&$filter=properties/usageEnd+ge+'2019-02-12'+AND+properties/usageEnd+le+'2019-02-14'
0
votes

Try by adding milliseconds precision to your dates. For example, try the following:

properties/usageStart eq '2019-02-01T00:00:00.0000000Z' and properties/usageEnd eq '2019-02-14T00:00:00.0000000Z'