0
votes

I am trying to calculate metric for all the web app inside a subscription using get-azmetric cmdlet and I am using -aggregation type parameter so how can we apply more than one aggregation type in -aggregation type parameter

1

1 Answers

0
votes

No, you could not apply more than one aggregation type in this parameter, the AggregationType just accepts only one value in one time, also see the description.

enter image description here

Your option is to run the command several times like below.

Get-AzMetric -ResourceId "<ResourceId>" -MetricName "CpuTime" -AggregationType Average

Get-AzMetric -ResourceId "<ResourceId>" -MetricName "CpuTime" -AggregationType Count

Update:

$types = @("Average", "Count", "Minimum", "Maximum", "Total")
$types | ForEach {Get-AzMetric -ResourceId "ResourceId" -MetricName "CpuTime" -AggregationType $_}