Install Azure CLI on Pengwin inside WSL2

To be honest, I didn't expect that I'll have to write this post when I started on my quest to get Azure CLI working in Pengwin. But here I'm sharing what I've learned. #SharingIsCaring

Things that didn't work I expected

So I went to the Install the Azure CLI page as anyone else would do, and had a look at the options, I knew that Pengwin is built on top of Debian, so I started with the first option: Install with apt...

First try: Install with apt

The instructions on the page were clear: curl -sL | sudo bash easy as that, but the result was not what I expected:

Failed to install with official script

Second try: Manual install instructions

I was still on the Install Azure CLI with apt page, but scrolled down to the manual instructions.

And they worked, they really did, but I ended up with a really old version and I need the latest.

Third try: Go back to the first option

I tried executing curl -sL | sudo bash again, but the result or really the error what I got stayed the same.

I knew I had to break out of this evil recursion, it didn't matter anymore if I wasn't able to install it on my own.

The solution: Twitter and help from nice folks

It was clear to me that alone I'll never figure this one out, I'm just too deep into Windows, but smart people know their limits so I went to Twitter and started tweeting about my failures. Some might say I started to complain, which might be true, I'm human :)

@AzureSupport was there for me, and later this nice guy JMP (@bureado) joined the conversation and explained the error message to me - a much needed help I must say 🙏 - and suggested to try to install from the binary package:

I already had an older version installed - I don't know if this counts as an update or not, or if going straight to the binary would have worked without the older version or not... - so I just downloaded the matching file of my Pengwin version azure-cli_2.4.0-1~buster_all.deb and installed it using dpkg strait from the downloads folder of my Windows user - remember, I'm using Pengwin in WSL2.

And it worked!

Azure CLI installing from binary package

JMP, thanks again for your help!

David Sass

David Sass

David is a highly skilled SharePoint Guy who is focusing on Automation, Compliance, Security, Operational Excellence, Quality Assurance and hacking the unexpected out of the technology stack.