Edit

Share via


New-AzAutoscaleScaleRuleObject

Create an in-memory object for ScaleRule.

Syntax

Default (Default)

New-AzAutoscaleScaleRuleObject
    -MetricTriggerMetricName <String>
    -MetricTriggerMetricResourceUri <String>
    -MetricTriggerOperator <ComparisonOperationType>
    -MetricTriggerStatistic <MetricStatisticType>
    -MetricTriggerThreshold <Double>
    -MetricTriggerTimeAggregation <TimeAggregationType>
    -MetricTriggerTimeGrain <TimeSpan>
    -MetricTriggerTimeWindow <TimeSpan>
    -ScaleActionCooldown <TimeSpan>
    -ScaleActionDirection <ScaleDirection>
    -ScaleActionType <ScaleType>
    [-MetricTriggerDimension <IScaleRuleMetricDimension[]>]
    [-MetricTriggerDividePerInstance <Boolean>]
    [-MetricTriggerMetricNamespace <String>]
    [-MetricTriggerMetricResourceLocation <String>]
    [-ScaleActionValue <String>]
    [<CommonParameters>]

Description

Create an in-memory object for ScaleRule.

Examples

Example 1: Create scale rule object

$subscriptionId = (Get-AzContext).Subscription.Id
New-AzAutoscaleScaleRuleObject -MetricTriggerMetricName "Percentage CPU" -MetricTriggerMetricResourceUri "/subscriptions/$subscriptionId/resourceGroups/test-group/providers/Microsoft.Compute/virtualMachineScaleSets/test-vmss" -MetricTriggerTimeGrain ([System.TimeSpan]::New(0,1,0)) -MetricTriggerStatistic "Average" -MetricTriggerTimeWindow ([System.TimeSpan]::New(0,5,0)) -MetricTriggerTimeAggregation "Average" -MetricTriggerOperator "GreaterThan" -MetricTriggerThreshold 10 -MetricTriggerDividePerInstance $false -ScaleActionDirection "Increase" -ScaleActionType "ChangeCount" -ScaleActionValue 1 -ScaleActionCooldown ([System.TimeSpan]::New(0,5,0))

Create scale rule object

Parameters

-MetricTriggerDimension

List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. To construct, see NOTES section for METRICTRIGGERDIMENSION properties and create a hash table.

Parameter properties

Type:

IScaleRuleMetricDimension[]

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

-MetricTriggerDividePerInstance

a value indicating whether metric should divide per instance.

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

-MetricTriggerMetricName

the name of the metric that defines what the rule monitors.

Parameter properties

Type:String
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

-MetricTriggerMetricNamespace

the namespace of the metric that defines what the rule monitors.

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

-MetricTriggerMetricResourceLocation

the location of the resource the rule monitors.

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

-MetricTriggerMetricResourceUri

the resource identifier of the resource the rule monitors.

Parameter properties

Type:String
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

-MetricTriggerOperator

the operator that is used to compare the metric data and the threshold.

Parameter properties

Type:ComparisonOperationType
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

-MetricTriggerStatistic

the metric statistic type. How the metrics from multiple instances are combined.

Parameter properties

Type:MetricStatisticType
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

-MetricTriggerThreshold

the threshold of the metric that triggers the scale action.

Parameter properties

Type:Double
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

-MetricTriggerTimeAggregation

time aggregation type. How the data that is collected should be combined over time. The default value is Average.

Parameter properties

Type:TimeAggregationType
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

-MetricTriggerTimeGrain

the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute.

Parameter properties

Type:TimeSpan
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

-MetricTriggerTimeWindow

the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 12 hours and 5 minutes.

Parameter properties

Type:TimeSpan
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

-ScaleActionCooldown

the amount of time to wait since the last scaling action before this action occurs. It must be between 1 week and 1 minute in ISO 8601 format.

Parameter properties

Type:TimeSpan
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

-ScaleActionDirection

the scale direction. Whether the scaling action increases or decreases the number of instances.

Parameter properties

Type:ScaleDirection
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

-ScaleActionType

the type of action that should occur when the scale rule fires.

Parameter properties

Type:ScaleType
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

-ScaleActionValue

the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1.

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

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

ScaleRule