Azure CLI を正常にインストールする方法

Azure CLI を正常にインストールする方法

Azure CLI のインストールで問題が発生しています。 3 つの方法を試しましたが、すべて失敗しました。

最初の2つはWindows に Azure CLI をインストールする、 私はもう試した

  • PowerShellを使用してAzure CLIをインストールし、
  • Azure CLI .msi ファイルの最新リリースを自分でダウンロードしてインストールします。
  • 削除して、.msi ファイルを使用して再インストールすることも試しました。

しかし、すべてのケースにおいて、と入力するとaz

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

それから私は試したLinux に Azure CLI をインストールする最後の手段として試みたが、これも失敗に終わった。

+ 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.

答え1

Windowsでは、Azure CLIが見つかります。az.cmdここ:
C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin

このパスは環境変数で見つけることができますPath: ここに画像の説明を入力してください

パワーシェル: $Env:Path

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

Azure CLI を msi ファイルを使用してインストールすると、アプリケーションがインストールされ、その場所がPath変数に追加されます。

開いている PowerShell がある場合、はPathバックグラウンドで自動的に更新されません。PowerShell を閉じて、新しいセッションを開く必要があります。通常、更新されたものPathが読み込まれます。この動作は、他の多くのアプリケーションにも適用されます。

したがって、(または安全を期したい場合)マシンを再起動するのが賢明かもしれません。

ところで、Windows 11 で環境変数を更新する (再起動なし)例えば、Chocolatey

関連情報