Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update azure-cli on Windows?

az --version is telling to update my CLI installation without explaining what to do. So what is the az command to install the updates, if there is any? I can't seem to find it anywhere.

I've tried looking for answers here: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-windows?view=azure-cli-latest and here: https://github.com/MicrosoftDocs/azure-docs-cli/issues/1341 but can't seem to find anything related to updating it.

my-username@Azure:~$ az --versionazure-cli                         2.0.72 *
command-modules-nspkg               2.0.3
core                              2.0.72 *
nspkg                              3.0.4
telemetry                          1.0.3

Extensions:
interactive                        0.4.3

Python location '/opt/az/bin/python3'
Extensions directory '/home/my-username/.azure/cliextensions'

Python (Linux) 3.6.5 (default, Aug 22 2019, 06:32:32)
[GCC 5.4.0 20160609]

Legal docs and information: aka.ms/AzureCliLegal


You have 2 updates available. Consider updating your CLI installation.

I'm looking for something similar to apt-get command in Linux for installing, upgrading and cleaning packages.

like image 629
Himesh Ravi Avatar asked Sep 12 '19 06:09

Himesh Ravi


People also ask

How do I update my Azure command to latest version?

By default, auto-upgrade for Azure CLI is disabled. If you would like to keep up with the latest version, you can enable auto-upgrade through configuration. The Azure CLI will check new versions regularly and prompt you to upgrade after any command finishes running once the update is available.

Can you use Azure CLI on Windows?

The Azure Command-Line Interface (CLI) is a cross-platform command-line tool that can be installed locally on Windows computers. You can use the Azure CLI for Windows to connect to Azure and execute administrative commands on Azure resources.

What is the latest version of Azure CLI?

The current version of the Azure CLI is 2.39.

How do you check if Azure CLI is installed in Windows?

Once the CLI is installed, you can check if the utility has been correctly installed by running the command “az –version“. This command will show the current version of the tool and the other modules that are available to be used by the CLI tool. Note that in the figure below, the installed version of the tool is 2.5.


2 Answers

based on what you've said:

I'm looking for something similar to apt-get command in Linux for installing, upgrading and cleaning packages.

You could update Azure CLI with the help of Chocolatey. Chocolatey is a package manager for Windows (like apt-get but for Windows).

Once you have Chocolatey installed (I use it for most of my application installations on Windows), you can install the Azure CLI package that you want to update like this from the Command Line:

choco upgrade azure-cli

You end-up seeing an screen like this:

enter image description here

As you can see from the previous image I'm updating from version 2.0.45 in to version 2.8.0. Once the installation is complete you should be able to see ii reflected:

az --version
azure-cli                          2.8.0

...

Your CLI is up-to-date.

I hope it helps.

like image 73
Sebastian Inones Avatar answered Oct 19 '22 06:10

Sebastian Inones


From Microsoft's documentation:

The CLI provides an in-tool command to update to the latest version:

az upgrade

However the documentation notes:

The az upgrade command was added in version 2.11.0 and will not work with versions prior to 2.11.0.

like image 21
orangecaterpillar Avatar answered Oct 19 '22 06:10

orangecaterpillar