az alias
Note
此参考是 Azure CLI(版本 2.0.31.dev0 或更高版本)的 别名 扩展的一部分。 该扩展将在首次运行 az alias 命令时自动安装。 了解更多关于扩展的信息。
管理 Azure CLI 别名。
命令
| 名称 | 说明 | 类型 | Status |
|---|---|---|---|
| az alias create |
创建别名。 |
Extension | GA |
| az alias export |
将所有已注册的别名导出到给定路径,作为 INI 配置文件。 如果未指定导出路径,则别名配置文件将导出到当前工作目录。 |
Extension | GA |
| az alias import |
从 INI 配置文件或 URL 导入别名。 |
Extension | GA |
| az alias list |
列出已注册的别名。 |
Extension | GA |
| az alias remove |
删除一个或多个别名。 要删除的别名以空格分隔。 |
Extension | GA |
| az alias remove-all |
删除所有已注册的别名。 |
Extension | GA |
az alias create
创建别名。
az alias create --command
--name
示例
创建简单的别名命令。
az alias create --name rg --command group
az alias create --name ls --command list
创建复杂的别名。
az alias create --name list-vm --command 'vm list --resource-group myResourceGroup'
使用参数创建别名命令。
az alias create --name 'list-vm {{ resource_group }}' \
--command 'vm list --resource-group {{ resource_group }}'
使用 Jinja2 模板处理参数。
az alias create --name 'storage-ls {{ url }}' \
--command 'storage blob list
--account-name {{ url.replace("https://", "").split(".")[0] }}
--container-name {{ url.replace("https://", "").split("/")[1] }}'
必需参数
别名指向的命令。
别名的名称。
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
az alias export
将所有已注册的别名导出到给定路径,作为 INI 配置文件。 如果未指定导出路径,则别名配置文件将导出到当前工作目录。
az alias export [--exclude]
[--path]
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
从导出中排除的空间分隔别名。
要导出到的别名配置文件的路径。
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
az alias import
从 INI 配置文件或 URL 导入别名。
az alias import --source
必需参数
要从中导入的别名的源。
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
az alias list
列出已注册的别名。
az alias list
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
az alias remove
删除一个或多个别名。 要删除的别名以空格分隔。
az alias remove --name
必需参数
空格分隔的别名。
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
az alias remove-all
删除所有已注册的别名。
az alias remove-all [--yes]
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
不要提示确认。
| 属性 | 值 |
|---|---|
| 默认值: | False |
全局参数
提高日志记录详细程度以显示所有调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
| 属性 | 值 |
|---|---|
| 默认值: | False |
输出格式。
| 属性 | 值 |
|---|---|
| 默认值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
| 属性 | 值 |
|---|---|
| 默认值: | False |