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

az monitor autoscale rule copy Copy autoscale rules from one profile to another.
az monitor autoscale rule create Add a new autoscale rule.
az monitor autoscale rule delete Remove autoscale rules from a profile.
az monitor autoscale rule list List autoscale rules for a profile.

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]
[--subscription]

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
--subscription

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

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]
[--subscription]
[--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"

Required Parameters

--autoscale-name

Name of the autoscale settings.

--condition

The condition which triggers the scaling action.

--scale

The direction and amount to scale.

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').

--subscription

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

--timegrain

The way metrics are polled across instances.

default value: avg 1m

az monitor autoscale rule delete

Remove autoscale rules from a profile.

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

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
--subscription

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

az monitor autoscale rule list

List autoscale rules for a profile.

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

Examples

List autoscale rules for a profile (autogenerated)

az monitor autoscale rule list --autoscale-name MyAutoscale --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
--subscription

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