In a previous post, we showed the steps of how to create an Linux development environment on a Windows 10 and why Linux is the best development environment. We shared specifically How to create a Linux Azure CLI 2.0 Workstation.
In this post we’ll show you the must have Linux extensions to have a an Azure Admin.

Install Updates

As always update our sources and upgrade our packages

sudo apt-get update && apt-get upgrade -y

Node.js and npm

Node.js and npm packages are available from the Ubuntu 18.04 distribution repository.

sudo -H apt install nodejs npm -y

Restart the shell

PIP

PIP is a Python package installer
For python 2.x

sudo -H apt-get install python-pip

JQ

JQ is a flexible command-line JSON processor. JQ is like sed for JSON data – you can use it to slice and filter and map and transform structured data with the same ease that sed, awk, grep and friends let you play with text. JQ syntax is like JMESPath, but do not mistake them, they are similar but not the same.

sudo -H apt-get install jq

The following example will get just the ID and NAME properties of the accounts in Azure for the context user.

az account list | jq '.[]|{id,name}'

JMESPath

JMESPath is an expression language for manipulating JSON documents. You can check out the JMESPath site for more information.
The Azure CLI uses the --query argument to execute a JMESPath query on the results of commands. JMESPath is a query language for JSON, giving you the ability to select and modify data from CLI output. Queries are executed on the JSON output before any display formatting. The --query argument is supported by all commands in the Azure CLI.
The following example will get just the ID and NAME properties of the accounts in Azure for the context user.

az account list --query [].[id,name]

jpterm

The JMESPath Terminal makes it easy to see the results of your JMESPath expressions immediately as you type.

sudo pip install jmespath-terminal

you run the jpterm as follows

az group list  > group.json
jpterm group.json

F5 or Ctrl + c Quit the program.
Ctrl + p Toggle between outputting the current result, expression, or nothing.
Ctrl + ] Clear the current expression.

Have any suggestions? email me.

Categories: Article