Azure 命令列介面 (CLI)Azure Command-Line Interface (CLI)

Azure 命令列介面 (CLI) 是用來管理 Azure 資源的 Microsoft 跨平台命令列體驗。The Azure command-line interface (CLI) is Microsoft's cross-platform command-line experience for managing Azure resources. 您可以透過 Azure Cloud Shell 在瀏覽器中使用,或者在 macOS、Linux 或 Windows 中安裝並從命令列中執行。Use it in your browser with Azure Cloud Shell, or install it on macOS, Linux, or Windows and run it from the command line.

Azure CLI 可讓您輕鬆地開始使用,且最適合用來建置可與搭配 Azure Resource Manager 運作的自動化指令碼。The Azure CLI is easy to get started with, and best used for building automation scripts that work with the Azure Resource Manager. 使用 Azure CLI,您只要輕鬆輸入下列命令,就可以在 Azure 中建立 VM:Using the Azure CLI, you can create VMs within Azure as easily as typing the following command:

az vm create -n MyLinuxVM -g MyResourceGroup --image UbuntuLTS


在指令碼及 Microsoft 文件網站中,Azure CLI 範例均以 bash 殼層適用的方式撰寫。In scripts and on the Microsoft documentation site, Azure CLI examples are written for the bash shell. 單行範例可在任何平台上執行。One-line examples will run on any platform. 包含以行接續 (\) 的較長範例,或變數指派則要加以修改,以便在包括 PowerShell 等其他殼層中使用。Longer examples which include line continuations (\) or variable assignment need to be modified to work on other shells, including PowerShell.

執行或安裝Run or Install

您可以在本機安裝 CLI、在瀏覽器中使用 Azure Cloud Shell 執行,或在 Docker 容器中執行。You can install the CLI locally, run it in the browser with Azure Cloud Shell, or run in a Docker container. 若要取得目前的 CLI 版本,請執行 az --versionTo get the current version of the CLI, run az --version.

透過 Microsoft Learn 增進您的技巧Build your skills with Microsoft Learn

開始使用Get started

閱讀開始使用文章來了解 CLI 基本概念。Read the Get Started article to learn the CLI basics. 下列範例會示範一些常見的使用案例:The following samples demonstrate some common uses cases:

另提供詳細的參考,說明如何使用每個個別的 Azure CLI 命令。A detailed reference is also available that documents how to use each individual Azure CLI command.


如果您使用舊版的 CLI (Azure 傳統 CLI),可以繼續使用。If you use the previous version of the CLI (Azure classic CLI), you can continue to use it. 不過,建議您更新以使用最新版的 Azure CLI,可獲得最佳體驗。However, we recommend updating to use the latest version of the Azure CLI for the best experience. 如果您同時使用這兩種 CLI,請記住,azure 是傳統 CLI,而 az 是最新的 CLI。If you use both CLIs, remember that azure is the classic CLI and that az is the most recent CLI.