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

az group

管理资源组和模板部署。

命令

名称 说明 类型 Status
az group create

创建新的资源组。

Core GA
az group delete

删除资源组。

Core GA
az group exists

检查资源组是否存在。

Core GA
az group export

将资源组捕获为模板。

Core GA
az group list

列出资源组。

Core GA
az group lock

管理 Azure 资源组锁。

Core GA
az group lock create

创建资源组锁。

Core GA
az group lock delete

删除资源组锁。

Core GA
az group lock list

列出资源组中的锁信息。

Core GA
az group lock show

显示资源组锁的详细信息。

Core GA
az group lock update

更新资源组锁。

Core GA
az group show

获取资源组。

Core GA
az group update

更新资源组。

Core GA
az group wait

将 CLI 置于等待状态,直到满足资源组的条件。

Core GA

az group create

创建新的资源组。

az group create --location
                --name --resource-group
                [--managed-by]
                [--tags]

示例

在美国西部区域创建新的资源组。

az group create -l westus -n MyResourceGroup

必需参数

--location -l

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

--name --resource-group -g -n

新资源组的名称。

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--managed-by

管理此资源组的资源的 ID。

--tags

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

全局参数
--debug

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

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

显示此帮助消息并退出。

--only-show-errors

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

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

Output format.

属性
默认值: 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 group delete

删除资源组。

az group delete --name --resource-group
                [--force-deletion-types {Microsoft.Compute/virtualMachineScaleSets, Microsoft.Compute/virtualMachines, Microsoft.Databricks/workspaces}]
                [--no-wait]
                [--yes]

示例

删除资源组。

az group delete -n MyResourceGroup

强制删除资源组中的所有虚拟机。

az group delete -n MyResourceGroup --force-deletion-types Microsoft.Compute/virtualMachines

必需参数

--name --resource-group -g -n

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

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--force-deletion-types -f

要强制删除的资源类型。

属性
接受的值: Microsoft.Compute/virtualMachineScaleSets, Microsoft.Compute/virtualMachines, Microsoft.Databricks/workspaces
--no-wait

不等待长时间运行的操作完成。

属性
默认值: False
--yes -y

不要提示确认。

属性
默认值: False
全局参数
--debug

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

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

显示此帮助消息并退出。

--only-show-errors

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

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

Output format.

属性
默认值: 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 group exists

检查资源组是否存在。

az group exists --name --resource-group

示例

检查是否存在“MyResourceGroup”。

az group exists -n MyResourceGroup

必需参数

--name --resource-group -g -n

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

全局参数
--debug

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

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

显示此帮助消息并退出。

--only-show-errors

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

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

Output format.

属性
默认值: 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 group export

将资源组捕获为模板。

az group export --name --resource-group
                [--include-comments]
                [--include-parameter-default-value]
                [--resource-ids]
                [--skip-all-params]
                [--skip-resource-name-params]

必需参数

--name --resource-group -g -n

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

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--include-comments

导出包含注释的模板。

属性
默认值: False
--include-parameter-default-value

导出具有默认值的模板参数。

属性
默认值: False
--resource-ids

用于筛选导出依据的空间分隔资源 ID。 若要导出所有资源,请不要指定此参数或提供“*”。

--skip-all-params

导出模板参数并跳过所有参数化。

属性
默认值: False
--skip-resource-name-params

导出模板并跳过资源名称参数化。

属性
默认值: False
全局参数
--debug

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

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

显示此帮助消息并退出。

--only-show-errors

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

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

Output format.

属性
默认值: 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 group list

列出资源组。

az group list [--tag]

示例

列出位于美国西部区域的所有资源组。

az group list --query "[?location=='westus']"

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--tag

采用“key[=value]”格式的单个标记。 使用“”清除现有标记。

全局参数
--debug

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

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

显示此帮助消息并退出。

--only-show-errors

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

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

Output format.

属性
默认值: 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 group show

获取资源组。

az group show --name --resource-group

必需参数

--name --resource-group -g -n

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

全局参数
--debug

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

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

显示此帮助消息并退出。

--only-show-errors

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

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

Output format.

属性
默认值: 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 group update

更新资源组。

az group update --name --resource-group
                [--force-string]
                [--set]
                [--tags]

示例

更新资源组。 (autogenerated)

az group update --resource-group MyResourceGroup --set tags.CostCenter='{"Dept":"IT","Environment":"Test"}'

必需参数

--name --resource-group -g -n

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

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--force-string

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

属性
Parameter group: Generic Update Arguments
默认值: False
--set

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

属性
Parameter group: Generic Update Arguments
默认值: []
--tags

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

全局参数
--debug

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

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

显示此帮助消息并退出。

--only-show-errors

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

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

Output format.

属性
默认值: 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 group wait

将 CLI 置于等待状态,直到满足资源组的条件。

az group wait --name --resource-group
              [--created]
              [--custom]
              [--deleted]
              [--exists]
              [--interval]
              [--timeout]
              [--updated]

示例

将 CLI 置于等待状态,直到满足资源组的条件。 (autogenerated)

az group wait --created  --resource-group MyResourceGroup

将 CLI 置于等待状态,直到满足资源组的条件。 (autogenerated)

az group wait --deleted --resource-group MyResourceGroup

必需参数

--name --resource-group -g -n

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

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--created

等待在“Succeeded”中使用“provisioningState”创建。

属性
Parameter group: Wait Condition Arguments
默认值: False
--custom

等待条件满足自定义 JMESPath 查询。 例如 provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running']。

属性
Parameter group: Wait Condition Arguments
--deleted

等到删除为止。

属性
Parameter group: Wait Condition Arguments
默认值: False
--exists

等待资源存在。

属性
Parameter group: Wait Condition Arguments
默认值: False
--interval

轮询间隔(以秒为单位)。

属性
Parameter group: Wait Condition Arguments
默认值: 30
--timeout

最大等待(以秒为单位)。

属性
Parameter group: Wait Condition Arguments
默认值: 3600
--updated

等到 provisioningState 更新为“Succeeded”。

属性
Parameter group: Wait Condition Arguments
默认值: False
全局参数
--debug

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

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

显示此帮助消息并退出。

--only-show-errors

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

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

Output format.

属性
默认值: 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