New-​Azure​Rm​Autoscale​Rule

Creates an Autoscale rule.

Syntax

New-AzureRmAutoscaleRule
   -MetricName <String>
   -MetricResourceId <String>
   -Operator <ComparisonOperationType>
   -MetricStatistic <MetricStatisticType>
   -Threshold <Double>
   [-TimeAggregationOperator <TimeAggregationType>]
   -TimeGrain <TimeSpan>
   [-TimeWindow <TimeSpan>]
   -ScaleActionCooldown <TimeSpan>
   -ScaleActionDirection <ScaleDirection>
   [-ScaleActionScaleType <ScaleType>]
   -ScaleActionValue <String>
   [<CommonParameters>]

Description

The New-AzureRmAutoscaleRule cmdlet creates an Autoscale rule.

Examples

Example 1: Create a rule

PS C:\>$Rule = New-AzureRmAutoscaleRule -MetricName "Requests" -MetricResourceId "/subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/mywebsite" -Operator GreaterThan -MetricStatistic Average -Threshold 10 -TimeGrain 00:01:00 -ScaleActionCooldown 00:05:00 -ScaleActionDirection Increase -ScaleActionScaleType ChangeCount -ScaleActionValue "1"
MetricTrigger                                               ScaleAction
-------------                                               -----------
Microsoft.Azure.Management.Insights.Models.MetricTrigger    Microsoft.Azure.Management.Insights.Models.ScaleAction

This command creates a rule.

Example 2: Create two rules

PS C:\>$Rule1 = New-AzureRmAutoscaleRule -MetricName "Requests" -MetricResourceId "/subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/mywebsite" -Operator GreaterThan -MetricStatistic Average -Threshold 10 -TimeGrain 00:01:00 -ScaleActionCooldown 00:05:00 -ScaleActionDirection Increase -ScaleActionScaleType ChangeCount -ScaleActionValue "1" 

PS C:\> $Rule2 = New-AzureRmAutoscaleRule -MetricName "Requests" -MetricResourceId "/subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/mywebsite" -Operator GreaterThan -MetricStatistic Average -Threshold 10 -TimeGrain 00:01:00 -ScaleActionCooldown 00:10:00 -ScaleActionDirection Increase -ScaleActionScaleType ChangeCount -ScaleActionValue "2"
MetricTrigger                                               ScaleAction
-------------                                               -----------
Microsoft.Azure.Management.Insights.Models.MetricTrigger    Microsoft.Azure.Management.Insights.Models.ScaleAction
Microsoft.Azure.Management.Insights.Models.MetricTrigger    Microsoft.Azure.Management.Insights.Models.ScaleAction

The first command creates a rule for the Requests metric, and then stores it in the $Rule1 variable.

The second command creates a second rule for the Requests metric, and then stores it in the $Rule2 variable.

Required Parameters

-MetricName

Specifies the name of the metric.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-MetricResourceId

Specifies the metric resource ID.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-MetricStatistic

Specifies the metric statistic. The acceptable values for this parameter are:- Average

  • Min
  • Max
  • Sum
Type:MetricStatisticType
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Operator

Specifies the operator. The acceptable values for this parameter are:- Equals

  • NotEquals
  • GreaterThan
  • GreaterThanOrEqual
  • LessThan
  • LessThanOrEqual
Type:ComparisonOperationType
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ScaleActionCooldown

Specifies the Autoscale action cooldown time.

Type:TimeSpan
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ScaleActionDirection

Specifies the scale action direction. The acceptable values for this parameter are:- None

  • Increase
  • Decrease
Type:ScaleDirection
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ScaleActionValue

Specifies the action value.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Threshold

Specifies the threshold of the metric value.

Type:Double
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-TimeGrain

Specifies the time grain.

Type:TimeSpan
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-ScaleActionScaleType

Specifies the scale type. The acceptable values for this parameter are:- ChangeSize

  • ChangeCount
  • PercentChangeCount
  • ExactCount
Type:ScaleType
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-TimeAggregationOperator

Specifies the time aggregation operator. The acceptable values for this parameter are:- Average

  • Minimum
  • Maximum
  • Last
  • Total, Count
Type:TimeAggregationType
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-TimeWindow

Specifies the time window.

Type:TimeSpan
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False