Edit

Share via


New-AzDiagnosticSettingMetricSettingsObject

Create an in-memory object for MetricSettings.

Syntax

Default (Default)

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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Enabled

a value indicating whether this category is enabled.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RetentionPolicyDay

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

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RetentionPolicyEnabled

a value indicating whether the retention policy is enabled.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TimeGrain

the timegrain of the metric in ISO8601 format.

Parameter properties

Type:TimeSpan
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Outputs

MetricSettings