你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

New-AzAutoscaleScaleRuleObject

为 ScaleRule 创建内存中对象。

语法

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>]

说明

为 ScaleRule 创建内存中对象。

示例

示例 1:创建缩放规则对象

$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))

创建缩放规则对象

参数

-MetricTriggerDimension

维度条件列表。 例如:[{“DimensionName”:“AppName”,“Operator”:“Equals”,“Values”:[“App1”]},{“DimensionName”:“Deployment”,“Operator”:“Equals”,“Values”:[“default”]}]。 若要构造,请参阅 METRICTRIGGERDIMENSION 属性的 NOTES 部分,并创建哈希表。

参数属性

类型:

IScaleRuleMetricDimension[]

默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-MetricTriggerDividePerInstance

一个值,该值指示指标是否应按实例划分。

参数属性

类型:Boolean
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-MetricTriggerMetricName

定义规则监视器的指标的名称。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-MetricTriggerMetricNamespace

定义规则监视器的指标的命名空间。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-MetricTriggerMetricResourceLocation

规则监视的资源的位置。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-MetricTriggerMetricResourceUri

规则监视的资源的资源标识符。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-MetricTriggerOperator

用于比较指标数据和阈值的运算符。

参数属性

类型:ComparisonOperationType
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-MetricTriggerStatistic

指标统计信息类型。 如何合并来自多个实例的指标。

参数属性

类型:MetricStatisticType
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-MetricTriggerThreshold

触发缩放操作的指标的阈值。

参数属性

类型:Double
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-MetricTriggerTimeAggregation

时间聚合类型。 收集的数据如何随时间推移进行组合。 默认值为 Average。

参数属性

类型:TimeAggregationType
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-MetricTriggerTimeGrain

规则监视器的指标粒度。 必须是从指标定义的预定义值之一。 必须介于 12 小时到 1 分钟之间。

参数属性

类型:TimeSpan
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-MetricTriggerTimeWindow

收集实例数据的时间范围。 此值必须大于指标集合中的延迟,这可能因资源到资源而异。 必须介于 12 小时到 5 分钟之间。

参数属性

类型:TimeSpan
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ScaleActionCooldown

自执行此操作之前上次缩放操作以来要等待的时间量。 它必须介于 1 周到 1 分钟之间,采用 ISO 8601 格式。

参数属性

类型:TimeSpan
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ScaleActionDirection

刻度方向。 缩放操作是增加还是减少实例数。

参数属性

类型:ScaleDirection
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ScaleActionType

缩放规则触发时应发生的操作的类型。

参数属性

类型:ScaleType
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ScaleActionValue

缩放操作中涉及的实例数。 此值必须为 1 或更大。 默认值为 1。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

CommonParameters

此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters

输出

ScaleRule