1

I'm having problem installing Azure CLI. I've tried three methods but all failed.

The first two are from Install Azure CLI on Windows, I've tried

  • install the Azure CLI using PowerShell, and
  • Download and install the latest release of the Azure CLI .msi file myself.
  • I've tried remove it and reinstalled using the .msi file as well.

But for all cases, if I type az, I'll get

az : The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program.

Then I tried Install the Azure CLI on Linux as last resort, but it failed too:

+ echo 'deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ bullseye main'
+ apt-get update
Hit:1 http://security.debian.org/debian-security bullseye-security InRelease
Hit:2 http://deb.debian.org/debian bullseye InRelease                                                                
Hit:3 http://ftp.debian.org/debian bullseye-backports InRelease                                                      
Hit:4 http://deb.debian.org/debian bullseye-updates InRelease                                                        
Hit:5 http://ppa.launchpad.net/suntong001/ppa/ubuntu focal InRelease                               
Get:6 https://packages.microsoft.com/repos/azure-cli bullseye InRelease [10.4 kB]
Err:6 https://packages.microsoft.com/repos/azure-cli bullseye InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF
Reading package lists... Done
W: http://security.debian.org/debian-security/dists/bullseye-security/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/microsoft.gpg are ignored as the file is not readable by user '_apt' executing apt-key.
W: http://deb.debian.org/debian/dists/bullseye/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/microsoft.gpg are ignored as the file is not readable by user '_apt' executing apt-key.
W: http://ftp.debian.org/debian/dists/bullseye-backports/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/microsoft.gpg are ignored as the file is not readable by user '_apt' executing apt-key.
W: http://deb.debian.org/debian/dists/bullseye-updates/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/microsoft.gpg are ignored as the file is not readable by user '_apt' executing apt-key.
W: http://ppa.launchpad.net/suntong001/ppa/ubuntu/dists/focal/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/microsoft.gpg are ignored as the file is not readable by user '_apt' executing apt-key.
W: https://packages.microsoft.com/repos/azure-cli/dists/bullseye/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/microsoft.gpg are ignored as the file is not readable by user '_apt' executing apt-key.
W: GPG error: https://packages.microsoft.com/repos/azure-cli bullseye InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF
E: The repository 'https://packages.microsoft.com/repos/azure-cli bullseye InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

xpt
  • 9,385
  • 44
  • 120
  • 178

1 Answers1

1

On windows, you can find the Azure CLI az.cmd here:
C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin

And this path can be found in the Environment variable Path: enter image description here

PowerShell: $Env:Path

C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;

If you install Azure CLI with a msi file, it will install the application and add the location to the Path variable.

If there's an open PowerShell, the Path is not refreshed automatically in the background. You have to close PowerShell and open a new session. Usually, the updated Path is loaded. This behavior also applies to a lot more applications.

So, it might make sense (or if you want to be on the safe side) to restart your machine.

BTW: It's also possible to refresh Environment Variables in Windows 11 (Without Reboot) with e.g. Chocolatey

Markus Meyer
  • 1,910