逸凡 avatar

使用 Powershell 或 CMD 在 Windows 11 或 10 上安装 Azure CLI

ericjiang

Published: 08 Sept 2023 › Updated: 08 Sept 2023使用 Powershell 或 CMD 在 Windows 11 或 10 上安装 Azure CLI

使用 Powershell 或 CMD 在 Windows 11 或 10 上安装 Azure CLI

先决条件


若要完成本教程,用户必须具备以下条件:

  • 具有管理权限的 Windows OS 10 或 11。
  • PowerShell 访问以使用 Azure CLI
  • 用于下载安装 Azure CLI 所需文件的互联网连接

第 1 步:打开 PowerShell

在这里,我们使用PowerShell来安装Azure CLI工具,但是,命令提示符的步骤也将相同。因此,首先,在管理员权限下打开您想使用的任何它们中的任何一个。

为此,请单击Windows开始按钮并搜索PowerShell,然后将鼠标悬停在其上并选择“以管理员身份运行”选项。

Running-Powershell-as-Admin-for-Windows-11

第 2 步:检查 Winget 的可用性

本教程的主要动机是仅使用命令行在 Windows 上安装 Azure。因此,我们不会访问任何网站来获取此 CLI 工具的可执行文件。因此,与Linux一样,我们在Windows 10和11系统中也有一个包管理器,也称为“ Winget”。要检查它是否可用,请运行给定的命令,您将在输出中看到其版本号。
winget -v

步骤 3:在 Windows 10 或 11 上安装 Azure CLI

在此步骤中,我们将执行“winget”命令,该命令不仅会下载最新的可用 Azure CLI 工具设置,甚至可以安装相同的设置,而无需用户干预。
winget install Microsoft.AzureCLI

步骤 4:Azure CLI 版本

完成安装后,首先关闭用于安装它的 PowerShell 或命令提示符。之后再次打开它,以便可以在我们的系统上识别已安装的 Azure CLI 工具的路径。完成后,在CMD或Powershell上键入给定的命令,该命令不仅会提供该工具的唯一当前版本,还会提供Azure CLI的扩展目录。
az --version
Installing-Azure-CLI-on-Windows-10-or-11

卸载(可选)

如果不需要使用命令终端,从Windows中删除Azure CLI也非常容易。使用相同的 Winget 包管理器,但这次使用“卸载”参数。
winget uninstall Microsoft.AzureCLI
Removal-of-the-Azure-CLI-from-Windows

现在我们已经在Windows上安装了Azure CLI,但只使用CLI。可以在Microsoft网站上进一步查看此工具可用的官方文档,以管理 Azure 资源、自动执行任务并简化云管理工作流。

Leave 使用 Powershell 或 CMD 在 Windows 11 或 10 上安装 Azure CLI to:

Written by

穷不怪父 孝不比兄,苦不责妻,气不凶子

Read more #azure posts


Best Posts From 逸凡

We have not curated any of ericjiang's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From 逸凡