LinuxCommandLibrary

az-upgrade

Update the Azure CLI to the latest version

TLDR

Upgrade Azure CLI

$ az upgrade
copy

Upgrade Azure CLI and Extensions
$ az upgrade --all
copy

Upgrade Azure CLI and Extensions without prompting for confirmation
$ az upgrade --all [[-y|--yes]]
copy

SYNOPSIS

az upgrade [--version <version>] [--dry-run] [--yes]

PARAMETERS

--dry-run
    Preview upgrades without installing.

--version <version>
    Upgrade to specific version (e.g., 2.65.0).

--yes, -y
    Skip confirmation prompts.

DESCRIPTION

The az upgrade command updates the Azure Command-Line Interface (CLI) to the newest version available on PyPI. It is designed for pip-based installations on Linux, macOS, and Windows.

Executing az upgrade checks the current version against the latest release, lists packages to update (including core CLI and extensions), and prompts for confirmation before installing via pip. This ensures users always have access to the latest features, bug fixes, and security patches.

It handles dependencies automatically and supports specifying a particular version for controlled upgrades. For non-pip installs (e.g., apt, yum, brew, MSI), use the respective package manager instead, as az upgrade will fail or warn.

Requires Python 3.8+, pip, and internet access. Run as user or with sudo if needed for system-wide installs. Post-upgrade, verify with az version. Common in CI/CD pipelines for keeping CLI current in automated workflows.

CAVEATS

Works only for pip installs; use package managers for others. Needs internet and Python/pip. May require elevated privileges.

EXAMPLES

az upgrade
az upgrade --dry-run
az upgrade --yes --version 2.65.0

REQUIREMENTS

Python 3.8+, pip 21.3.1+, internet connection.

HISTORY

Introduced in Azure CLI 2.0 (2018); evolved with CLI releases from Microsoft since 2017 for simplified self-updates.

SEE ALSO

az version(1), pip(1), python(1)

Copied to clipboard