Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Format-MetricsAsTable

Format-MetricsAsTable

microsoft.azure.commands.insights.dll

Synopsis

Formats the output of the Get-Metrics Cmdlet as an array of records, one for each metric value to be used by the Export-csv Cdmlet.

Syntax

Format-MetricsAsTable [-Metrics] [-Profile] [<CommonParameters>]

Detailed Description

Formats the output of the Get-Metrics Cmdlet as an array of records, one for each metric value. The output of this Cmdlet is suitable to be processed by the Export-csv Cmdlet.

Parameters

-Metrics <Metric[]>

An array of Metric objects. This is usually the output of the Get-Metrics Cmdlet.

Aliases

None

Required?

true

Position

0

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-Profile <AzureProfile>

In-memory profile (AzureProfile).

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

Input Type


Return Type


Notes

Examples

-------------------------- Example 1: Typical use to export to Excel --------------------------

Export the output of Get-Metrics to a csv file that is readable by Excel.

"Name","TimestampUTC","Count","Last","Maximum","Minimum","Total","Average","StartTimeUTC","EndTimeUTC","TimeGrain","Unit","DimensionName","DimensionValue","ResourceId" "AverageResponseTime","2015-03-20 16:15:00","1",,,,"0","0","2015-03-20 16:14:00","2015-03-20 17:14:35","00:01:00","Seconds",,,"/subscriptions/b91eb07f-89c3-40be-bf3b-40fdcba10f6c/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/website1" "AverageResponseTime","2015-03-20 16:17:00","1",,,,"0","0","2015-03-20 16:14:00","2015-03-20 17:14:35","00:01:00","Seconds",,,"/subscriptions/b91eb07f-89c3-40be-bf3b-40fdcba10f6c/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/website1" "AverageResponseTime","2015-03-20 16:18:00","1",,,,"0","0","2015-03-20 16:14:00","2015-03-20 17:14:35","00:01:00","Seconds",,,"/subscriptions/b91eb07f-89c3-40be-bf3b-40fdcba10f6c/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/website1"

$s = get-metrics -res /subscriptions/b91eb07f-89c3-40be-bf3b-40fdcba10f6c/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/garyyang1 -time 00:01:00 -det
$s2 = format-metricsastable $s
foreach($e in $s2) { Export-csv -Path ./metrics.csv -input $e -Append -NoTypeInformation}

Online Version
Get-Metrics