az monitor autoscale rule

Manage autoscale scaling rules.

For more information on autoscaling, visit: https://docs.microsoft.com/azure/monitoring-and-diagnostics/monitoring-understanding-autoscale-settings.

Commands

Name Description Type Status
az monitor autoscale rule copy

Copy autoscale rules from one profile to another.

Core GA
az monitor autoscale rule create

Add a new autoscale rule.

Core GA
az monitor autoscale rule delete

Remove autoscale rules from a profile.

Core GA
az monitor autoscale rule list

List autoscale rules for a profile.

Core GA

az monitor autoscale rule copy

Copy autoscale rules from one profile to another.

az monitor autoscale rule copy --autoscale-name
                               --dest-schedule
                               --index
                               --resource-group
                               [--source-schedule]

Required Parameters

--autoscale-name

Name of the autoscale settings.

--dest-schedule

Name of the profile to copy rules to.

--index

Space-separated list of rule indices to copy, or '*' to copy all rules.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--source-schedule

Name of the profile to copy rules from.

default value: default
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az monitor autoscale rule create

Add a new autoscale rule.

az monitor autoscale rule create --autoscale-name
                                 --condition
                                 --scale
                                 [--cooldown]
                                 [--profile-name]
                                 [--resource]
                                 [--resource-group]
                                 [--resource-namespace]
                                 [--resource-parent]
                                 [--resource-type]
                                 [--timegrain]

Examples

Scale to 5 instances when the CPU Percentage across instances is greater than 75 averaged over 10 minutes.

az monitor autoscale rule create -g {myrg} --autoscale-name {myvmss} \
  --scale to 5 --condition "Percentage CPU > 75 avg 10m"

Scale up 2 instances when the CPU Percentage across instances is greater than 75 averaged over 5 minutes.

az monitor autoscale rule create -g {myrg} --autoscale-name {myvmss} \
  --scale out 2 --condition "Percentage CPU > 75 avg 5m"

Scale down 50% when the CPU Percentage across instances is less than 25 averaged over 15 minutes.

az monitor autoscale rule create -g {myrg} --autoscale-name {myvmss} \
  --scale in 50% --condition "Percentage CPU < 25 avg 15m"

Create autoscale settings via a guest vm metric enabled from diagnostic extensions. You can use counterSpecifier field retrieved from 'az vmss diagnostics get-default-config' in the `--condition`.

az monitor autoscale rule create -g {myrg} --autoscale-name test --scale out 1 --condition "/builtin/memory/percentavailablememory > 80 total 5m"

Required Parameters

--autoscale-name

Name of the autoscale settings.

--condition

The condition which triggers the scaling action.

Usage: --condition ["NAMESPACE"] METRIC {==,!=,>,>=,<,<=} THRESHOLD {avg,min,max,total,count} PERIOD [where DIMENSION {==,!=} VALUE [or VALUE ...] [and DIMENSION {==,!=} VALUE [or VALUE ...] ...]]

Dimensions can be queried by adding the 'where' keyword and multiple dimensions can be queried by combining them with the 'and' keyword. Values for METRIC and appropriate THRESHOLD values can be obtained from the az monitor metric command. Format of PERIOD is "##h##m##s".

--scale

The direction and amount to scale.

Usage: --scale {to,in,out} VAL[%] Fixed Count: --scale to 5 In by Count: --scale in 2 Out by Percent: --scale out 10%.

Optional Parameters

--cooldown

The number of minutes that must elapse before another scaling event can occur.

default value: 5
--profile-name

Name of the autoscale profile.

default value: default
--resource

Name or ID of the target resource.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--resource-namespace

Target resource provider namespace.

--resource-parent

Target resource parent path, if applicable.

--resource-type

Target resource type. Can also accept namespace/type format (Ex: 'Microsoft.Compute/virtualMachines').

--timegrain

The way metrics are polled across instances.

The form of the timegrain is {avg,min,max,sum} VALUE. Values can be obtained from the az monitor metric command. Format of VALUE is "##h##m##s".

default value: avg 1m
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az monitor autoscale rule delete

Remove autoscale rules from a profile.

az monitor autoscale rule delete --autoscale-name
                                 --index
                                 --resource-group
                                 [--profile-name]

Required Parameters

--autoscale-name

Name of the autoscale settings.

--index

Space-separated list of rule indices to remove, or '*' to clear all rules.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--profile-name

Name of the autoscale profile.

default value: default
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az monitor autoscale rule list

List autoscale rules for a profile.

az monitor autoscale rule list --autoscale-name
                               --resource-group
                               [--profile-name]

Examples

List autoscale rules for a profile. (autogenerated)

az monitor autoscale rule list --autoscale-name MyAutoscale --profile-name MyProfile --resource-group MyResourceGroup

Required Parameters

--autoscale-name

Name of the autoscale settings.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--profile-name

Name of the autoscale profile.

default value: default
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.