New-AzAutoscaleScaleRuleObject
Create an in-memory object for ScaleRule.
Syntax
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.
Type: | IScaleRuleMetricDimension[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MetricTriggerDividePerInstance
a value indicating whether metric should divide per instance.
Type: | Boolean |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MetricTriggerMetricName
the name of the metric that defines what the rule monitors.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MetricTriggerMetricNamespace
the namespace of the metric that defines what the rule monitors.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MetricTriggerMetricResourceLocation
the location of the resource the rule monitors.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MetricTriggerMetricResourceUri
the resource identifier of the resource the rule monitors.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MetricTriggerOperator
the operator that is used to compare the metric data and the threshold.
Type: | ComparisonOperationType |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MetricTriggerStatistic
the metric statistic type. How the metrics from multiple instances are combined.
Type: | MetricStatisticType |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MetricTriggerThreshold
the threshold of the metric that triggers the scale action.
Type: | Double |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MetricTriggerTimeAggregation
time aggregation type. How the data that is collected should be combined over time. The default value is Average.
Type: | TimeAggregationType |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | 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.
Type: | TimeSpan |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | 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.
Type: | TimeSpan |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | 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.
Type: | TimeSpan |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ScaleActionDirection
the scale direction. Whether the scaling action increases or decreases the number of instances.
Type: | ScaleDirection |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ScaleActionType
the type of action that should occur when the scale rule fires.
Type: | ScaleType |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | 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.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Outputs
Azure PowerShell