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
az upgrade -h
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.
--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.
--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:
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).
When the user provides an input of
y, then the az CLI MSI installer will appear.
Suppressing the Confirmation Prompt
To avoid the pain of the pressing
Y to confirm the upgrade, use the following command:
az upgrade --yes
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.
Use the following command to install the Azure CLI using Chocolatey without a prompt, from an administrator PowerShell session:
choco install azure-cli -y
Upgrading the Azure CLI using Chocolatey, use the following command:
choco upgrade azure-cli -y