Microsoft Azure – Using Table Parameter in Azure CLI
In this article, you’ll learn how to use the Table Parameter to change the format of the output when you’re issuing commands with the Azure CLI. When you’re working with version 2.0 of the Azure CLI, the results from the commands that you’re on are typically returned to you in the JSON format.
So, for instance, if we want to search for our resource groups, we can simply use the below command:
az group list
What you see is our resource group listings are returned to us in a JSON format.
Now, this may not necessarily be the way that you want to see your results. So, what we can do instead is we could use the output option, and we could specify the format we want it to be returned in. So here, we want to specify the table as follows:
az group list --output table
Now, when we execute our command, you’ll see that our results returned to us in a tabular format.
Now, we might not necessarily want to have to do this every time we run a command. What we can do instead is we can use the below command and what this will allow us to do is change some of our settings, so we can make our default format to be table instead of JSON:
So, we are going to slide to the table, and we are just going to leave the rest of these other options as they are.
Now, if we are supposed to execute our command again, you’ll see by default, instead of getting JSON, we are now getting tabular data returned back from our command: