New-AzAutoscaleRule
Creates an Autoscale rule.
Syntax
New-AzAutoscaleRule
-MetricName <String>
-MetricResourceId <String>
-Operator <ComparisonOperationType>
-MetricStatistic <MetricStatisticType>
-Threshold <Double>
[-TimeAggregationOperator <TimeAggregationType>]
-TimeGrain <TimeSpan>
[-TimeWindow <TimeSpan>]
-ScaleActionCooldown <TimeSpan>
-ScaleActionDirection <ScaleDirection>
[-ScaleActionScaleType <ScaleType>]
-ScaleActionValue <String>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The New-AzAutoscaleRule cmdlet creates an Autoscale rule.
Examples
Example 1: Create a rule
PS C:\>$Rule = New-AzAutoscaleRule -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-AzAutoscaleRule -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-AzAutoscaleRule -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.
Parameters
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure
Type: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MetricName
Specifies the name of the metric.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-MetricResourceId
Specifies the metric resource ID.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-MetricStatistic
Specifies the metric statistic. The acceptable values for this parameter are:
- Average
- Min
- Max
- Sum
Type: | MetricStatisticType |
Accepted values: | Average, Min, Max, Sum |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Operator
Specifies the operator. The acceptable values for this parameter are:
- Equals
- NotEquals
- GreaterThan
- GreaterThanOrEqual
- LessThan
- LessThanOrEqual
Type: | ComparisonOperationType |
Accepted values: | Equals, NotEquals, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ScaleActionCooldown
Specifies the Autoscale action cooldown time.
Type: | TimeSpan |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ScaleActionDirection
Specifies the scale action direction. The acceptable values for this parameter are:
- None
- Increase
- Decrease
Type: | ScaleDirection |
Accepted values: | None, Increase, Decrease |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ScaleActionScaleType
Specifies the scale type. The acceptable values for this parameter are:
- ChangeSize
- ChangeCount
- PercentChangeCount
- ExactCount
Type: | ScaleType |
Accepted values: | ChangeCount, PercentChangeCount, ExactCount |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ScaleActionValue
Specifies the action value.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Threshold
Specifies the threshold of the metric value.
Type: | Double |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
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 |
Accepted values: | Average, Minimum, Maximum, Total, Count |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TimeGrain
Specifies the time grain.
Type: | TimeSpan |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TimeWindow
Specifies the time window.
Type: | TimeSpan |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |