Skip to content

How to do dataset Aggregation with Invoke-AzCostManagementQuery? #17710

Answered by CaptainFanZzz
Sweggle asked this question in Q&A
Discussion options

You must be logged in to vote

@Sweggle , when I try to use hashtable for -DatasetAggregation , even if it’s null value, it works.

Here's my script:

$hashtable = @{}
Invoke-AzCostManagementQuery -Scope subscriptions/xxxx-xxxx-xxxx-xxxx-xxxx -Timeframe MonthToDate -Type Usage -DatasetAggregation $hashtable

or

$aggregation = Get-Content ./Aggregation.json | Convertfrom-Json -AsHashtable
Invoke-AzCostManagementQuery -Scope subscriptions/xxxx-xxxx-xxxx-xxxx-xxxx -Timeframe MonthToDate -Type Usage -DatasetAggregation $aggregation

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@Sweggle
Comment options

@CaptainFanZzz
Comment options

@Sweggle
Comment options

Answer selected by dingmeng-xue
Comment options

You must be logged in to vote
1 reply
@Sweggle
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
needs-author-feedback More information is needed from author to address the issue. Cost Management - Query All issues in cost management and Consumption for query API associated to tags, dimensions and forec
3 participants