The Azure CLI can be updated from the command-line in Windows. The command az upgrade is used for this, and it has a few options which are useful. Like all Azure CLI (az) commands, there is help that can be revealed when running the command with the -h

az upgrade -h
Update Azure CLI from the command-line (az upgrade) 1
running the az upgrade help command

The two arguments that are shown with the help include:

--all         : Enable updating extensions as well.  Allowed values: false, true.  Default:
                true.
--yes -y      : Do not prompt for checking release notes.

The --all is very useful in that when the upgrade happens all extensions that are installed will also be upgraded. It is possible to also pass false if for some reason this is not desired.

The --yes is useful in that the upgrade can be down without an interactive MSI installer window.



Upgrade Azure CLI Interactive Mode

To update the Azure CLI (az), without the silent install, use the following command:

az upgrade

The cli will then check the current version against the most recent version available. The user will then be prompted to continue with the upgrade (if one is available).

Update Azure CLI from the command-line (az upgrade) 2
az upgrade without the –yes

When the user provides an input of y, then the az CLI MSI installer will appear.

Update Azure CLI from the command-line (az upgrade) 3
az msi installer

Suppressing the Confirmation Prompt

To avoid the pain of the pressing Y to confirm the upgrade, use the following command:

az upgrade --yes
Update Azure CLI from the command-line (az upgrade) 4
the –yes only supresses typing Y

Note: It’s pretty disappointing that you can’t just do a silent install, but that’s the issue with using something like an MSI installer.


Using Chocolatey to install the az CLI

To avoid this type of issue, I would install the Azure CLI using Chocolatey. The installation is silent and then can also be updated using the command line.

Related: If you are new to using Chocolatey, then we recommend you check out the “Using Chocolatey with Azure VMs” article written by Dan Patrick.

Update Azure CLI from the command-line (az upgrade) 5
chocolately package for az cli

Use the following command to install the Azure CLI using Chocolatey without a prompt, from an administrator PowerShell session:

choco install azure-cli -y
Update Azure CLI from the command-line (az upgrade) 6
installing az cli using chocolately

Upgrading the Azure CLI using Chocolatey, use the following command:

choco upgrade azure-cli -y

Happy upgrading,

@deltadan

Microsoft MVP

Dan Patrick is the Chief Infrastructure Architect for Solliance and a 15 year veteran at Microsoft. He has an extensive background in IT Infrastructure and Operations. Dan has both architected and lead teams building and supporting some of the largest service providers in North America with as many 15,000 Windows Servers and 120 million endpoints. Dan has worked with Azure IaaS solutions extensively since 2012. He has a passion for Virtualization with deep experience leveraging Hyper-V, Vmware, and Citrix. He is also a Clustering specialist focusing on large host clusters and SQL Always On Availability Groups. Recently Dan, authored the Networking, Azure Active Directory and Containers portion of the 70-533 Exam Reference for Microsoft Press. You can follow him on Twitter @deltadan