How to use the command 'az version' (with examples)

How to use the command 'az version' (with examples)

The command ‘az version’ is used to display the current version of Azure CLI modules and extensions. It provides information about the version of Azure CLI being used, as well as the version of the installed modules and extensions.

Use case 1: Show the current version of Azure CLI modules and extensions in JSON format

Code:

az version

Motivation: This use case is useful when you need to programmatically retrieve the current version of the Azure CLI and its associated modules and extensions. JSON format is commonly used for programmatic processing of data.

Explanation: The command ‘az version’ retrieves and displays the current version of Azure CLI, modules, and extensions in JSON format. It does not require any additional arguments.

Example output:

{
  "azure-cli": "2.28.0",
  "azure-cli-core": "2.28.0",
  "azure-cli-telemetry": "1.1.0",
  ...
}

The output is a JSON object where the keys represent the names of the Azure CLI modules and extensions, and the values represent their respective versions. The example output shows a truncated list of modules and extensions for brevity.

Use case 2: Show the current version of Azure CLI modules and extensions in a given format

Code:

az version --output json|table|tsv

Motivation: This use case is useful when you want to customize the format of the output. The ‘–output’ option allows you to specify the desired format: ‘json’, ’table’, or ’tsv’ (tab-separated values).

Explanation: The command ‘az version’ with the ‘–output’ option allows you to specify the format of the output. The available formats are ‘json’, ’table’, and ’tsv’. By default, the output is displayed in a human-readable format.

Example output (using ‘–output table’):

Name                      Version
-----------------------  ---------------
azure-cli                 2.28.0
azure-cli-core            2.28.0
azure-cli-telemetry       1.1.0
...

The output is displayed in tabular format, showing the names of the Azure CLI modules and extensions in the left column, and their respective versions in the right column.

Conclusion:

The ‘az version’ command is a useful tool for retrieving the current version of Azure CLI modules and extensions. It provides flexibility in terms of output format, allowing you to choose between JSON, table, or tab-separated values.

Related Posts

How to use the command html5validator (with examples)

How to use the command html5validator (with examples)

This article provides examples of how to use the html5validator command to validate HTML5 files.

Read More
How to use the command 'nautilus' (with examples)

How to use the command 'nautilus' (with examples)

Nautilus is the default file explorer for the GNOME desktop environment.

Read More
How to use the command nim (with examples)

How to use the command nim (with examples)

The Nim compiler is a powerful tool used for processing, compiling, and linking Nim language source files.

Read More