Updating Azure CLI on WSL2
I came across an issue on my local system when attempting to update Azure CLI to the latest version so that I could check out the Azure Arc HCIBox Jumpstart (It needs at least version 2.40.0).
I’m running Windows 11, with WSL2 Ubuntu-20.04 and I installed the AZ CLI using the one line install command. At the time, it was version 2.39.0
I tried to use the ‘az upgrade’ command, but it didn’t work.
So I went to the link provided https://aka.ms/doc/InstallAzureCli
There was nothing regarding the issue I had, so I figured I had to remove the cli and re-install.
Here’s the command I ran to remove the CLI
rm -r $HOME/lib/azure-cli
rm $HOME/bin/az
sed -i '/$HOME\/lib\/azure-cli\/az.completion/d' $HOME/.bash_profile
hash -r
I figured I should use apt for the re-install:
sudo apt-get update && sudo apt-get install --only-upgrade -y azure-cli
Checking the version shows I now have the latest version:
And it looks like running ‘az upgrade’ should work…
Cool! Now it’s time to check out the HCIBox ;)