Share via


az alias

Note

This reference is part of the alias extension for the Azure CLI (version 2.0.31.dev0 or higher). The extension will automatically install the first time you run an az alias command. Learn more about extensions.

Manage Azure CLI Aliases.

Commands

Name Description Type Status
az alias create

Create an alias.

Extension GA
az alias export

Export all registered aliases to a given path, as an INI configuration file. If no export path is specified, the alias configuration file is exported to the current working directory.

Extension GA
az alias import

Import aliases from an INI configuration file or an URL.

Extension GA
az alias list

List the registered aliases.

Extension GA
az alias remove

Remove one or more aliases. Aliases to be removed are space-delimited.

Extension GA
az alias remove-all

Remove all registered aliases.

Extension GA

az alias create

Create an alias.

az alias create --command
                --name

Examples

Create simple alias commands.

az alias create --name rg --command group

az alias create --name ls --command list

Create a complex alias.

az alias create --name list-vm --command 'vm list --resource-group myResourceGroup'

Create an alias command with arguments.

az alias create --name 'list-vm {{ resource_group }}' \
  --command 'vm list --resource-group {{ resource_group }}'

Process arguments using Jinja2 templates.

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] }}'

Required Parameters

--command -c

The command that the alias points to.

--name -n

The name of the alias.

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 alias export

Export all registered aliases to a given path, as an INI configuration file. If no export path is specified, the alias configuration file is exported to the current working directory.

az alias export [--exclude]
                [--path]

Optional Parameters

--exclude -e

Space-separated aliases excluded from export.

--path -p

The path of the alias configuration file to export to.

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 alias import

Import aliases from an INI configuration file or an URL.

az alias import --source

Required Parameters

--source -s

The source of the aliases to import from.

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 alias list

List the registered aliases.

az alias list
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 alias remove

Remove one or more aliases. Aliases to be removed are space-delimited.

az alias remove --name

Required Parameters

--name -n

Space-separated aliases.

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 alias remove-all

Remove all registered aliases.

az alias remove-all [--yes]

Optional Parameters

--yes -y

Do not prompt for confirmation.

Default value: False
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.