編集

次の方法で共有


New-AzDiagnosticSettingMetricSettingsObject

Create an in-memory object for MetricSettings.

Syntax

New-AzDiagnosticSettingMetricSettingsObject
   -Enabled <Boolean>
   [-Category <String>]
   [-RetentionPolicyDay <Int32>]
   [-RetentionPolicyEnabled <Boolean>]
   [-TimeGrain <TimeSpan>]
   [<CommonParameters>]

Description

Create an in-memory object for MetricSettings.

Examples

Example 1: Create metric setting object

New-AzDiagnosticSettingMetricSettingsObject -Enabled $true -Category AllMetrics -RetentionPolicyDay 7 -RetentionPolicyEnabled $true

Create metric setting object, to get supported categories for resource, please see Get-AzDiagnosticSettingCategory

Parameters

-Category

Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Enabled

a value indicating whether this category is enabled.

Type:Boolean
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-RetentionPolicyDay

the number of days for the retention in days. A value of 0 will retain the events indefinitely.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RetentionPolicyEnabled

a value indicating whether the retention policy is enabled.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TimeGrain

the timegrain of the metric in ISO8601 format.

Type:TimeSpan
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

MetricSettings