Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Sudharshan1919
Helper III
Helper III

Filters on Azure API

Hi All,

I am developing a billing/costing report using powershell where i am calling by API. Here is the API that i am using ( https://management.azure.com//subscriptions/xxxxxxxxxxxxxxxx//providers/Microsoft.Consumption/usageD... eq '+"'$yesterdayUtcTime'"+ '&api-version=2021-10-01)
For the $yesterdayUtcTime i am passing it by a variable ($yesterdayUtcTime=$time.ToUniversalTime().AddMonths(-1).ToString("yyyy-MM-ddT00:00:00.0000000Z").

1) Now, i want the API to be worked like, i need to pass the dates specifically, that means data i need is between 2 dates.
2) Also i need to call the API for last 30/60/90 days like that. means the data to be loaded for the last 30/60/90 days at a time.

Could any one please help on this.. I have tried few methods but none of them worked.

Thanks,
Sudharshan.

3 REPLIES 3
v-jianboli-msft
Community Support
Community Support

Hi @Sudharshan1919 ,

 

It seems that you can achieve your goal by setting the URL Parameter scope:

The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope and '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope. For subscription, billing account, department, enrollment account and management group, you can also add billing period to the scope using '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. to specify billing period at department scope use '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. 

 

Try something like: billingPeriods/202209

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-jianboli-msft
Community Support
Community Support

Hi @Sudharshan1919 ,

 

The $filter may be used to filter usageDetails by properties/resourceGroup, properties/resourceName, properties/resourceId, properties/chargeType, properties/reservationId, properties/publisherType or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). PublisherType Filter accepts two values azure and marketplace and it is currently supported for Web Direct Offer Type.

 

Here are some examples: Examples , hope it would help you.

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi,

 

My scenario is like, if i want to get the data in between 2 dates like start date and end date.

Ex: date between 2022-09-01 to 2022-09-31 - 1 months

 

Please suggest on this.

 

Thanks,

 

Thanks

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.