'How to install the latest extension in Azure CLI

I have installed aks-preview extension with below command. Unfortunately, it didn't install the latest version, which at the moment of writing this question is 0.5.64. How to install the latest extension in Azure CLI?

az extension add --name aks-preview

Edited: Running extension update command still keeps me with current (old) version.

az extension update --name aks-preview


Solution 1:[1]

Simply run

az extension update --name aks-preview

Solution 2:[2]

I fixed it. It turned out that I had to first upgrade azure cli, and then install the extension.

$ az version
{
  "azure-cli": "2.30.0",
}

$ az upgrade

$ az version
{
  "azure-cli": "2.36.0",
}


# az extension remove --name aks-preview
# az extension add --name aks-preview
$ az extension update --name aks-preview

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 CSharpRocks
Solution 2