你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

az monitor autoscale

管理自动缩放设置。

命令

名称 说明 类型 Status
az monitor autoscale create

创建新的自动缩放设置。

Core GA
az monitor autoscale delete

删除自动缩放设置。

Core GA
az monitor autoscale list

列出资源组的自动缩放设置。

Core GA
az monitor autoscale profile

管理自动缩放配置文件。

Core GA
az monitor autoscale profile create

创建固定或定期自动缩放配置文件。

Core GA
az monitor autoscale profile delete

删除自动缩放配置文件。

Core GA
az monitor autoscale profile list

列出自动缩放配置文件。

Core GA
az monitor autoscale profile list-timezones

查找时区信息。

Core GA
az monitor autoscale profile show

显示自动缩放配置文件的详细信息。

Core GA
az monitor autoscale rule

管理自动缩放缩放规则。

Core GA
az monitor autoscale rule copy

将自动缩放规则从一个配置文件复制到另一个配置文件。

Core GA
az monitor autoscale rule create

添加新的自动缩放规则。

Core GA
az monitor autoscale rule delete

从配置文件中删除自动缩放规则。

Core GA
az monitor autoscale rule list

列出配置文件的自动缩放规则。

Core GA
az monitor autoscale show

获取自动缩放设置。

Core GA
az monitor autoscale show-predictive-metric

显示预测自动缩放指标的未来数据。

Core GA
az monitor autoscale update

更新自动缩放设置。

Core GA

az monitor autoscale create

创建新的自动缩放设置。

az monitor autoscale create --count
                            --resource
                            [--action]
                            [--disabled {false, true}]
                            [--email-administrator {false, true}]
                            [--email-coadministrators {false, true}]
                            [--location]
                            [--max-count]
                            [--min-count]
                            [--name]
                            [--resource-group]
                            [--resource-namespace]
                            [--resource-parent]
                            [--resource-type]
                            [--scale-look-ahead-time]
                            [--scale-mode {Disabled, Enabled, ForecastOnly}]
                            [--tags]

示例

创建自动缩放设置以在 2 到 5 个实例之间缩放(默认为 3 个)。 缩放发生时向管理员发送电子邮件。

az monitor autoscale create -g {myrg} --resource {resource-id} --min-count 2 --max-count 5 \
  --count 3 --email-administrator

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

az monitor autoscale rule create -g {myrg} --autoscale-name {resource-name} --scale in 1 \
  --condition "Percentage CPU < 25 avg 5m"

为正好 4 个实例创建自动缩放设置。

az monitor autoscale create -g {myrg} --resource {resource-id} --count 4

创建新的自动缩放设置。 (autogenerated)

az monitor autoscale create --count 3 --max-count 5 --min-count 2 --name MyAutoscaleSettings --resource myScaleSet --resource-group MyResourceGroup --resource-type Microsoft.Compute/virtualMachineScaleSets

必需参数

--count

要使用的实例的分子数。 如果与 --min/max-count 一起使用,则使用的默认实例数。

属性
参数组: Instance Limit Arguments
--resource

目标资源的名称或 ID。

属性
参数组: Target Resource Arguments

可选参数

以下参数是可选的,但根据上下文,命令可能需要一个或多个参数才能成功执行。

--action -a

添加在缩放事件发生时触发的操作。

用法:--action TYPE KEY [ARG ...]电子邮件:--action 电子邮件 bob@contoso.comann@contoso.com Webhook: --action webhook https://www.contoso.com/alert apiKey=value Webhook: --action webhook https://www.contoso.com/alert?apiKey=value 多个操作可以使用多个 --action 参数指定。

属性
参数组: Notification Arguments
--disabled

创建处于禁用状态的自动缩放设置。

属性
接受的值: false, true
--email-administrator

在缩放时向订阅管理员发送电子邮件。

属性
参数组: Notification Arguments
接受的值: false, true
--email-coadministrators

在缩放时向订阅共同管理员发送电子邮件。

属性
参数组: Notification Arguments
接受的值: false, true
--location -l

Location. az account list-locations 中的值。 可以使用 az configure --defaults location=<location> 配置默认位置。

--max-count

最大实例数。

属性
参数组: Instance Limit Arguments
--min-count

最小实例数。

属性
参数组: Instance Limit Arguments
--name -n

自动缩放设置的名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

属性
参数组: Target Resource Arguments
--resource-namespace

目标资源提供程序命名空间。

属性
参数组: Target Resource Arguments
--resource-parent

目标资源父路径(如果适用)。

属性
参数组: Target Resource Arguments
--resource-type

目标资源类型。 还可以接受命名空间/类型格式(例如:“Microsoft.Compute/virtualMachines”。

属性
参数组: Target Resource Arguments
--scale-look-ahead-time

指定提前启动实例的时间量。 它必须是 ISO 8601 格式的 1 分钟到 60 分钟(例如,100 天将是 P100D)。

属性
参数组: Predictive Policy Arguments
--scale-mode

预测自动缩放模式。

属性
参数组: Predictive Policy Arguments
接受的值: Disabled, Enabled, ForecastOnly
--tags

空格分隔标记:key[=value] [key[=value] ...]。使用“”清除现有标记。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az monitor autoscale delete

删除自动缩放设置。

az monitor autoscale delete [--autoscale-name --name]
                            [--ids]
                            [--resource-group]
                            [--subscription]

可选参数

以下参数是可选的,但根据上下文,命令可能需要一个或多个参数才能成功执行。

--autoscale-name --name -n

自动缩放设置名称。

属性
参数组: Resource Id Arguments
--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

属性
参数组: Resource Id Arguments
--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

属性
参数组: Resource Id Arguments
--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

属性
参数组: Resource Id Arguments
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az monitor autoscale list

列出资源组的自动缩放设置。

az monitor autoscale list --resource-group
                          [--max-items]
                          [--next-token]

必需参数

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

可选参数

以下参数是可选的,但根据上下文,命令可能需要一个或多个参数才能成功执行。

--max-items

命令输出中要返回的项总数。 如果可用的项总数大于指定的值,则会在命令的输出中提供令牌。 若要恢复分页,请在后续命令的 --next-token 参数中提供令牌值。

属性
参数组: Pagination Arguments
--next-token

用于指定开始分页的位置的令牌。 这是先前截断的响应中的令牌值。

属性
参数组: Pagination Arguments
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az monitor autoscale show

获取自动缩放设置。

az monitor autoscale show [--autoscale-name --name]
                          [--ids]
                          [--resource-group]
                          [--subscription]

示例

显示自动缩放设置详细信息。

az monitor autoscale show --name MyAutoscaleSettings --resource-group MyResourceGroup

可选参数

以下参数是可选的,但根据上下文,命令可能需要一个或多个参数才能成功执行。

--autoscale-name --name -n

自动缩放设置名称。

属性
参数组: Resource Id Arguments
--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

属性
参数组: Resource Id Arguments
--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

属性
参数组: Resource Id Arguments
--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

属性
参数组: Resource Id Arguments
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az monitor autoscale show-predictive-metric

显示预测自动缩放指标的未来数据。

az monitor autoscale show-predictive-metric --aggregation
                                            --interval
                                            --metric-name
                                            --metric-namespace
                                            --timespan
                                            [--autoscale-setting-name]
                                            [--ids]
                                            [--resource-group]
                                            [--subscription]

必需参数

--aggregation

要检索的聚合类型列表(逗号分隔)。

--interval

查询的间隔(即时间根)。

--metric-name

要检索的指标的名称(逗号分隔)。 特殊情况:如果指标名本身有一个逗号,则使用 %2 来指示它。 例如:“Metric,Name1”应为“Metric%2Name1”。

--metric-namespace

要查询其指标定义的指标命名空间。

--timespan

查询的时间跨度。 它是格式为“startDateTime_ISO/endDateTime_ISO”的字符串。

可选参数

以下参数是可选的,但根据上下文,命令可能需要一个或多个参数才能成功执行。

--autoscale-setting-name

自动缩放设置名称。

属性
参数组: Resource Id Arguments
--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

属性
参数组: Resource Id Arguments
--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

属性
参数组: Resource Id Arguments
--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

属性
参数组: Resource Id Arguments
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az monitor autoscale update

更新自动缩放设置。

az monitor autoscale update [--add]
                            [--add-action --add-actions]
                            [--autoscale-name --name]
                            [--count]
                            [--email-administrator {0, 1, f, false, n, no, t, true, y, yes}]
                            [--email-coadministrators {0, 1, f, false, n, no, t, true, y, yes}]
                            [--enabled {0, 1, f, false, n, no, t, true, y, yes}]
                            [--force-string {0, 1, f, false, n, no, t, true, y, yes}]
                            [--ids]
                            [--max-count]
                            [--min-count]
                            [--remove]
                            [--remove-action --remove-actions]
                            [--resource-group]
                            [--scale-look-ahead-time]
                            [--scale-mode {Disabled, Enabled, ForecastOnly}]
                            [--set]
                            [--subscription]
                            [--tags]

示例

更新自动缩放设置,以默认使用固定的 3 个实例。

az monitor autoscale update -g myrg -n autoscale-name --count 3

更新自动缩放设置以删除电子邮件通知。

az monitor autoscale update -g myrg -n autoscale-name --remove-action email bob@contoso.com

更新自动缩放设置。

az monitor autoscale update --count 3 --email-administrator true --enabled true --max-count 5 --min-count 2 --name MyAutoscaleSettings --resource-group MyResourceGroup --tags key[=value]

可选参数

以下参数是可选的,但根据上下文,命令可能需要一个或多个参数才能成功执行。

--add

通过指定路径和键值对将对象添加到对象列表。 示例:--add property.listProperty <key=value, string or JSON string>

属性
参数组: Generic Update Arguments
--add-action --add-actions -a

添加在缩放事件发生时触发的操作。 用法:--add-action TYPE KEY [ARG ...]电子邮件:--add-action 电子邮件 bob@contoso.comann@contoso.com Webhook: --add-action webhook https://www.contoso.com/alert apiKey=value Webhook: --add-action webhook https://www.contoso.com/alert?apiKey=value 多个操作可以使用多个 --add-action 参数指定。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。

属性
参数组: Notification Arguments
--autoscale-name --name -n

自动缩放设置名称。

属性
参数组: Resource Id Arguments
--count

要使用的实例的分子数。 如果与 --min/max-count 一起使用,则使用的默认实例数。

属性
参数组: Instance Limit Arguments
--email-administrator

在缩放时向订阅管理员发送电子邮件。

属性
参数组: Notification Arguments
接受的值: 0, 1, f, false, n, no, t, true, y, yes
--email-coadministrators

在缩放时向订阅共同管理员发送电子邮件。

属性
参数组: Notification Arguments
接受的值: 0, 1, f, false, n, no, t, true, y, yes
--enabled

已启用的标志。 指定是否为资源启用自动缩放。 默认值为“false”。

属性
接受的值: 0, 1, f, false, n, no, t, true, y, yes
--force-string

使用“set”或“add”时,保留字符串文本,而不是尝试转换为 JSON。

属性
参数组: Generic Update Arguments
接受的值: 0, 1, f, false, n, no, t, true, y, yes
--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

属性
参数组: Resource Id Arguments
--max-count

最大实例数。

属性
参数组: Instance Limit Arguments
--min-count

最小实例数。

属性
参数组: Instance Limit Arguments
--remove

从列表中删除属性或元素。 示例: --remove property.list <indexToRemove> OR --remove propertyToRemove.

属性
参数组: Generic Update Arguments
--remove-action --remove-actions -r

删除一个或多个操作。 用法:--remove-action TYPE KEY [KEY ...]电子邮件:--remove-action 电子邮件 bob@contoso.comann@contoso.com Webhook:--remove-action webhook https://contoso.com/alerthttps://alerts.contoso.com。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。

属性
参数组: Notification Arguments
--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

属性
参数组: Resource Id Arguments
--scale-look-ahead-time

指定提前启动实例的时间量。 它必须是 ISO 8601 格式的 1 分钟到 60 分钟(例如,100 天将是 P100D)。

属性
参数组: Predictive Policy Arguments
--scale-mode

预测自动缩放模式。

属性
参数组: Predictive Policy Arguments
接受的值: Disabled, Enabled, ForecastOnly
--set

通过指定要设置的属性路径和值来更新对象。 示例:--set property1.property2=<value>

属性
参数组: Generic Update Arguments
--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

属性
参数组: Resource Id Arguments
--tags

获取或设置描述资源的键值对的列表。 这些标记可用于查看和分组此资源(跨资源组)。 最多可为资源提供 15 个标记。 每个标记的长度不得超过 128 个字符,且长度不超过 256 个字符的值。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

属性
默认值: False
--output -o

输出格式。

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False