In the last five lessons you wrote scripts for the budget, the resource group, permissions and policies. The same few moves kept coming up: --query, --output tsv, $LASTEXITCODE, -WhatIf. This lesson gathers them, explains them thoroughly and adds two tools: Resource Graph, which lets you query all resources at once, and a way to test scripts without any Azure at all. At the end there are two new scripts in the repository: one finds Kladde resources without an owner tag, the other adds it.

Output formats

Every Azure CLI command knows --output (-o for short) with these values:

Format What it’s for
json The default. Complete, long for humans, ideal for programs, for example with ConvertFrom-Json.
jsonc JSON with colors, only for reading in the terminal.
yaml, yamlc YAML, without and with colors.
table A table for reading.
tsv Values separated by tabs, without quotation marks, one line per result. For scripts.
none No output, only the exit code. For commands that change something and whose answer you don’t need.

The table has a catch: it leaves out fields like id, type and etag and writes column names like name as Name. If you want particular columns, give them names of your own with --query, as the scripts in this module do.