Estou tendo problemas para instalar a CLI do Azure. Eu tentei três métodos, mas todos falharam.
Os dois primeiros são do Install Azure CLI no Windows , eu tentei
- instale a CLI do Azure usando o PowerShell e
- Baixe e instale eu mesmo a versão mais recente do arquivo .msi da CLI do Azure.
- Eu tentei removê-lo e reinstalei usando o arquivo .msi também.
Mas para todos os casos, se eu digitar az
, obterei
az : The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program.
Em seguida, tentei Instalar a CLI do Azure no Linux como último recurso, mas também falhou:
+ 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.
No Windows, você pode encontrar a CLI do Azure az.cmd aqui:
C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin
E este caminho pode ser encontrado na variável Environment
Path
:PowerShell:
$Env:Path
Se você instalar a CLI do Azure com um arquivo msi, ele instalará o aplicativo e adicionará o local à
Path
variável.Se houver um PowerShell aberto, ele
Path
não será atualizado automaticamente em segundo plano. Você precisa fechar o PowerShell e abrir uma nova sessão. Normalmente, a atualizaçãoPath
é carregada. Esse comportamento também se aplica a muito mais aplicativos.Portanto, pode fazer sentido (ou se você quiser estar no lado seguro) reiniciar sua máquina.
BTW: também é possível atualizar variáveis de ambiente no Windows 11 (sem reinicialização) com, por exemplo, Chocolatey