Azure CLI 2.0 Output Format

Azure CLI 2.0

Azure CLI 2.0 uses JSON as its default output option but provides a way to format the output in any command line.

Types of output

Output    Description
json       JSON string. This setting is the default.
jsonic    Colorized JSON.
table       ASCII table with keys as column headings.
tsv          Tab-separated values, with no keys

First login to your Azure using this command - 
az login
Azure CLI 2.0 Output Format

After you're logged in, try the following commands to format your output using cmd.
az resource list --output table

Azure CLI 2.0 Output Format 

Similarly, you can also try the following using cmd. 

az resource list --output json
az resource list --output jsonic
az resource list --output tsv

These are the various ways by which you can format your output in Azure CLI 2.0. Also, this implies that you can configure the default setting. Here is the command for that.

az configure

Azure CLI 2.0 Output Format

By default, it is set to JSON. To change your configuration, press "y" and hit Enter. It will ask you to which format you want to configure.

Azure CLI 2.0 Output Format 

Make your selection by pressing the keys from 1 to 4 as shown in the above screen. In my case, I have selected 3. It will ask "Would you like to enable logging to file? " Press "yes " and hit Enter.

Now, try to list your Azure Resources without using --output

using cmd: az resource list

Azure CLI 2.0 Output Format


In this way, you can configure your output format of Azure CLI 2.0.