It can be extremely useful to use the Azure CLI to manage / manipulate your Azure resources from the command-line. However, many of the commands will output a large amount of JSON that can be extremely difficult to read at the command-line. When using the Azure CLI within the Bash shell, you can use a couple techniques to make the JSON output much more readable, and using these techniques will really increase your productivity at the command-line.

Azure CLI 2. 0 Command Output Options

When running many of the Azure CLI 2. 0 commands it will output JSON to the command-line. This can be difficult to read at the command-line, especially when you need to scroll a lot in order to sift through the huge output. To solve this the Azure CLI 2.0 supports the use of the “–output” or “-o” parameters to be appended to commands that allows you to easily modify the format of the commands output.

Here’s the “-o” / “–output” options supported:

  • table – outputs in an easily readable table format
  • json – outputs in JSON format
  • jsonc – outputs in JSON format with a little color highlighting
  • tsv – outputs in a tab delimited format

It’s really nice to have output format options, but the “table” option is likely the best to output an easily readable result, and the “jsonc” is probably the second best since it outputs JSON that’s a little easier to read.

Here’s a few example Azure CLI 2.0 commands using the Output parameter:

az resource list -o table

az resource list --output table

az web app show
    -g myblogsite
    -n myblogsite
    -o table

az vm list -o table

Filter Results using GREP

On Linux you can use “grep” to filter the results of the Azure CLI 2.0 command output. You can do this to easily sort out specific data in the result to easily find what you’re looking for.

Here’s an example of using “grep” by piping (via “|”) the results of the Azure CLI 2.0 command to “grep“:

az resource list -o table | grep "asia"

Here’s another example:

az resource list -o table | grep "blog"

If you’re using Linux or macOS, then the above techniques should work for you just fine. If you’re using Windows 10, you can install and use the Ubuntu Bash for Windows 10 to get access to the above techniques as well.

Happy scripting!!

Posted by Chris Pietschmann

Chris is a Microsoft MVP and has nearly 20 years of experience building enterprise systems both in the cloud and on-premises. He is also a Certified Microsoft Azure Solutions Architect (both MCSD and MCSE), a Microsoft Certified Trainer, and self proclaimed Cloud Advocate. He has a passion for technology and sharing what he learns with others to help enable them to learn faster and be more productive.


  1. […] Azure CLI 2.0: Make Bash Output More Readable (Chris Pietschmann) […]


  2. […] the command outputs. A detailed and wonderfully insightful article is covered by Chris Pietschmann here. In a nutshell, a multiple of output formats are now supported – json, jsonc, tsv and table. […]


  3. […] The default output of the Azure CLI is json, but you can also use other kind of output formats, as described in this blog. […]


  4. How do you loop in Azure CLI, i need to reboot list of node in azure batch.


    1. Chris Pietschmann March 1, 2018 at 7:47 pm

      This link in the documentation should help guide you in the right direction:


Leave a Reply to Dew Drop - June 1, 2017 (#2491) - Morning Dew Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.