How To Update Azure CLI

However, to use the latest features, security patches, and improvements, keeping your Azure CLI up to date is crucial. In this detailed article, I’ll walk you through how to update Azure CLI using multiple methods, tailored for different operating systems and environments. Whether you’re a developer or an admin, this step-by-step tutorial will ensure your Azure CLI stays current.

How To Update Azure CLI

Why You Should Regularly Update Azure CLI

Before we jump into the update methods, let’s quickly cover why updating Azure CLI is essential:

  • Access to new features: Microsoft continuously adds new commands and capabilities.
  • Security patches: Updates often include critical security fixes.
  • Bug fixes: Resolve issues that might cause unexpected behavior.
  • Improved performance: Optimizations make your CLI experience smoother.
  • Compatibility: Stay compatible with the latest Azure services and APIs.

Before updating, it’s good practice to check your current Azure CLI version. Open your terminal or command prompt and run:

az --version

After executing the above command, we got the version number as shown in the screenshot below.

How to Check Your Current Azure CLI Version

Method 1: Updating Azure CLI on Windows

Using the MSI Installer (Recommended)

To update Azure CLI, follow the steps below.

If you installed Azure CLI using the MSI installer on Windows, the easiest way to update is to download and run the latest MSI installer.

  1. Visit the Azure CLI Windows download page.
  2. Download the latest MSI installer.
How To Update Azure CLI

3. Run the installer and follow the prompts. It will detect your existing installation and update it.

how to update azure cli version
update azure cli windows

Note: This method is preferred for users who installed via MSI because it handles all dependencies and system PATH settings automatically.

Now, let us rerun the command below to check the updated version after the completion of the update process.

az --version

You can see that the Azure CLI has been updated successfully, as shown in the screenshot below.

update azure cli version

Using PowerShell (For Chocolatey Users)

If you installed Azure CLI using Chocolatey, update it via PowerShell:

choco upgrade azure-cli

This command upgrades Azure CLI to the latest version available in the Chocolatey repository.

Method 2: Updating Azure CLI on macOS

Using Homebrew (Recommended for macOS Users)

Homebrew is the most popular package manager for macOS, and if you installed Azure CLI this way, updating is simple.

  1. Open Terminal.
  2. Run the following commands:
brew update
brew upgrade azure-cli
  • brew update Updates Homebrew itself.
  • brew upgrade azure-cli Upgrades Azure CLI to the latest version.

Using the Manual Installer

If you installed Azure CLI manually via the installer script, you can update by re-running the installation script:

curl -sL https://aka.ms/InstallAzureCLIDeb | bash

This script works for both Debian-based Linux and macOS, and it will update your Azure CLI to the latest version.

Method 3: Updating Azure CLI on Linux

Using Package Managers (Debian/Ubuntu)

If you installed Azure CLI using the official Microsoft repository, update it with:

sudo apt-get update
sudo apt-get install --only-upgrade -y azure-cli

This fetches the latest package lists and upgrades Azure CLI if a newer version exists.

Using RPM-Based Distros (CentOS, Fedora, RHEL)

For RPM-based distributions, update Azure CLI by running:

sudo yum check-update
sudo yum update -y azure-cli

Or with dnf On newer Fedora systems:

sudo dnf upgrade -y azure-cli

Using the Install Script (All Linux Distros)

If you installed Azure CLI using the install script, rerun it:

curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

This ensures your installation is the latest version.

Method 4: Updating Azure CLI in Docker Containers

To update Azure CLI in a Docker container:

  1. Pull the latest Azure CLI image:
docker pull mcr.microsoft.com/azure-cli
  1. Run the container with the updated CLI:
docker run -it mcr.microsoft.com/azure-cli

If you have a custom Dockerfile, update the base image tag to the latest version:

FROM mcr.microsoft.com/azure-cli:latest

Then rebuild your container.

Method 5: Updating Azure CLI via Python Pip (Advanced Users)

If you installed Azure CLI using Python’s pip package manager, update it with:

pip install --upgrade azure-cli

Note: This method is less common and recommended for advanced users who prefer Python environments. Also, ensure your Python version is compatible with the Azure CLI version.

Summary Table: Azure CLI Update Methods by Platform

PlatformUpdate MethodCommand/ActionNotes
Windows (MSI)MSI InstallerDownload & run MSI from official siteRecommended for most users
Windows (Chocolatey)Chocolatey Package Managerchoco upgrade azure-cliFor Chocolatey users
macOSHomebrewbrew update && brew upgrade azure-cliPreferred for macOS users
macOS/LinuxInstall Scriptcurl -sL https://aka.ms/InstallAzureCLIDeb | bashWorks on Debian-based Linux & macOS
Linux (Debian)apt-getsudo apt-get update && sudo apt-get install --only-upgrade -y azure-cliFor Debian/Ubuntu
Linux (RPM)yum/dnfsudo yum update -y azure-cli or sudo dnf upgrade -y azure-cliFor CentOS/Fedora/RHEL
DockerPull latest imagedocker pull mcr.microsoft.com/azure-cliUse latest container image
Python (pip)pippip install --upgrade azure-cliFor Python-based installations

Final Thoughts

Keeping your Azure CLI updated is a simple but powerful way to ensure your cloud management journey is secure, efficient, and feature-rich. Whether you’re a developer or an IT administrator, following the methods I’ve outlined in this article will keep you running smoothly.

Azure Virtual Machine

DOWNLOAD FREE AZURE VIRTUAL MACHINE PDF

Download our free 25+ page Azure Virtual Machine guide and master cloud deployment today!