You can use Azure CLI 2.0 in interactive mode by running the
az interactive command.
That places you in an interactive shell where your commands are auto-completed
and you have access to descriptions of commands and their parameters and command examples.
We're not using the default style here, which doesn't read as well on a black background.
If you're not already logged in to your account, use the
login command to do that.
Interactive mode optionally displays command descriptions, parameter descriptions, and command examples.
You can turn descriptions and examples on or off using
You can turn the display of parameter defaults on or off using
F3 toggles the display of some key gestures.
You can scope your interactive mode to a specific command group like
When you do, all commands are interpreted in that scope.
It's a great shorthand if you're doing all your work in that command group.
Instead of typing these commands:
az>> vm create -n myVM -g myRG --image UbuntuLTS az>> vm list -o table
You can scope to the vm command group and type these commands:
az>> %%vm az vm>> create -n myVM -g myRG --image UbuntuLTS az vm>>list -o table
You can scope to lower-level command groups as well.
You could scope to
vm image using
In this case, since we're already scoped to
vm, we would use
az vm>> %%image az vm image>>
At that point, we can pop the scope back up to
or we can scope to the root with just
az vm image>> %% az>>
You can execute a JMESPath query on the results of the last command that you executed. For example, after you create a VM, you can make sure it has fully provisioned.
az>> vm create --name myVM --resource-group myRG --image UbuntuLTS --no-wait az>> ? [*].provisioningState
[ "Creating" ]
To learn more about querying the results of your commands, see Query command results with Azure 2.0.
You can run shell commands without leaving interactive mode using
Some commands have lots of examples.
You can scroll to the next page of examples using
CTRL-N and the previous page using
You can also look at a specific example using
az>> vm create ::8