< Back

New-AzureRmAutoscaleRule

Tue Jan 29, 2019 9:49 pm

NAME New-AzureRmAutoscaleRule



SYNOPSIS

Creates an Autoscale rule.





SYNTAX

New-AzureRmAutoscaleRule [-DefaultProfile <IAzureContextContainer>] -MetricName <String> -MetricResourceId <String> -MetricStatistic {Average |

Min | Max | Sum} -Operator {Equals | NotEquals | GreaterThan | GreaterThanOrEqual | LessThan | LessThanOrEqual} -ScaleActionCooldown <TimeSpan>

-ScaleActionDirection {None | Increase | Decrease} [-ScaleActionScaleType {ChangeCount | PercentChangeCount | ExactCount}] -ScaleActionValue

<String> -Threshold <Double> [-TimeAggregationOperator {Average | Minimum | Maximum | Total | Count}] -TimeGrain <TimeSpan> [-TimeWindow

<TimeSpan>] [<CommonParameters>]





DESCRIPTION

The New-AzureRmAutoscaleRule cmdlet creates an Autoscale rule.





PARAMETERS

-DefaultProfile <IAzureContextContainer>

The credentials, account, tenant, and subscription used for communication with azure



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-MetricName <String>

Specifies the name of the metric.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-MetricResourceId <String>

Specifies the metric resource ID.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-MetricStatistic <MetricStatisticType>

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



- Average



- Min



- Max



- Sum



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Operator <ComparisonOperationType>

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



- Equals



- NotEquals



- GreaterThan



- GreaterThanOrEqual



- LessThan



- LessThanOrEqual



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ScaleActionCooldown <TimeSpan>

Specifies the Autoscale action cooldown time.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ScaleActionDirection <ScaleDirection>

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



- None



- Increase



- Decrease



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ScaleActionScaleType <ScaleType>

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



- ChangeSize



- ChangeCount



- PercentChangeCount



- ExactCount



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ScaleActionValue <String>

Specifies the action value.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Threshold <Double>

Specifies the threshold of the metric value.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-TimeAggregationOperator <TimeAggregationType>

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



- Average



- Minimum



- Maximum



- Last



- Total, Count



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-TimeGrain <TimeSpan>

Specifies the time grain.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-TimeWindow <TimeSpan>

Specifies the time window.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None

This cmdlet does not accept any input.





OUTPUTS

Microsoft.Azure.Management.Monitor.Management.Models.ScaleRule







NOTES









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.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... oscalerule

Add-AzureRmAutoscaleSetting

Get-AzureRmAutoscaleHistory

Get-AzureRmAutoscaleSetting

New-AzureRmAutoscaleProfile

Remove-AzureRmAutoscaleSetting