A few months ago, Azure CLI 2.0 was released. It provides a command line interface to manage/administer Azure resources. Azure CLI is optimized to run automation scripts composed of multiple commands, hence the commands and the overall user experience is not interactive. Azure CLI Shell (az-shell) provides an interactive environment to run Azure CLI 2.0 commands, which is ideal for new users learning the Azure CLI’s capabilities, command structures, and output formats. It provides autocomplete dropdowns, auto-cached suggestions combined with on the fly documentation, including examples of how each command is used. Azure CLI Shell provides an experience that makes it easier to learn and use Azure CLI commands.
The shell implements gestures that can be used by users to customize it. F3 function key in the toolbar can be used to look up all the available gestures at any time.
The shell allows users to scope their commands to a specific group of commands. If you only want to work with ‘vm’ commands, you can use the following gesture to set the right scope so that you don’t have to type ‘vm’ with all subsequent commands:
Now, all the completions are ‘vm’ specific.
To remove a scope, the gesture is:
Or, if I wish to remove all scoping:
Scrolling through examples
The shell lists many examples for each command contextually, as you type your commands. However, some commands, like ‘vm create’ have too many examples to fit on the terminal screen. To look through all examples, you can scroll through the example pane with CTRLY and CTRLN for ‘up’ and ‘down’ , respectively.
With all the examples, you can easily select a specific one to view in the example pane.
$ [command] :: [example number]
The example number is indicated in the example pane. The shell takes the user through a step by step process to create the command and execute it.
Commands outside the shell
Azure CLI Shell allows a user to execute commands outside of Azure CLI from within the Shell itself. So you don’t need to exit out of the az-shell to add something to git, for example. Users can execute commands outside the shell with the gesture:
Query Previous Command
You can use a jmespath query on command outputs of type ‘json’ to quickly find properties/values that you want.
$ ? [jmespath query]
There is a gesture that allows users to see the exit code of the last command they ran, to check if it executed properly.
$ pip install --user azure-cli-shell
$ docker run -it azuresdk/azure-cli-shell:0.2.0
To start the application
Welcome to Azure CLI Shell
Azure CLI Shell is open source and located on GitHub . If there are any issues, they can be filed on the Github repository or e-mailed to azfeedback. You can also use the “az feedback” command directly from within az-shell or az as well.