# 使用 Homebrew, chocolatey, apt, dnf, MacPorts, Nix, pacman, zypper, scoop, winget 安装 azure-cli

查看 azure-cli 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:azure-cli
```

## 代理安全回答

azure-cli controls Azure accounts, resources, subscriptions, and deployments.

- **凭据访问:** Reads Azure account tokens, config files, cloud credentials, and environment variables.
- **远程变更:** Can create, delete, and reconfigure Azure infrastructure.
- **发布/制品风险:** Can deploy application artifacts and infrastructure templates.
- **推荐控制:** Gate mutating az commands and credential export or login changes.
- **代理使用指南:** Allow account/resource reads in safe subscriptions; require approval for writes and deletes.

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install azure-cli
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install azure-cli
```

  证据: MacPorts ports tree: sysutils/azure-cli/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- Debian apt (92%):

```sh
sudo apt install azure-cli
```

  证据: Debian stable package indexes: azure-cli from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- dnf (92%):

```sh
sudo dnf install azure-cli
```

  证据: Fedora Rawhide package metadata: azure-cli from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#azure-cli
```

  证据: nixpkgs package indexes: pkgs/by-name/az/azure-cli/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S azure-cli
```

  证据: Arch Linux sync databases: azure-cli from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- zypper (92%):

```sh
sudo zypper install azure-cli
```

  证据: openSUSE Tumbleweed package metadata: azure-cli from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

### Windows

- Chocolatey (92%):

```sh
choco install azure-cli
```

  证据: Chocolatey community package catalog: azure-cli from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','authy-desktop'

- Scoop (92%):

```sh
scoop install main/azure-cli
```

  证据: Scoop official bucket manifest trees: bucket/azure-cli.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

- winget (92%):

```sh
winget install --id Microsoft.AzureCLI -e
```

  证据: Windows Package Manager source index: Microsoft.AzureCLI from https://cdn.winget.microsoft.com/cache/source.msix

## 软件包事实

- **软件包键:** brew:azure-cli
- **软件包管理器:** Homebrew
- **版本:** 2.88.0
- **来源摘要:** Microsoft Azure CLI 2.0
- **主页:** <https://docs.microsoft.com/cli/azure/overview>
- **仓库:** <https://github.com/Azure/azure-cli>
- **最后更新:** 2026-07-07T09:03:39Z
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- az (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 2.88.0
## 项目历史与用法

Azure CLI is Microsoft's cross-platform `az` command-line client for managing Azure resources. It is one of the canonical cloud-provider CLIs in package-manager indexes because it turns Azure administration, provisioning, identity, and resource inspection into scriptable shell commands.

### 项目历史

The Azure CLI 2.x line was developed in the open at Azure/azure-cli as a next-generation, multi-platform Azure command-line experience. The repository's earliest GitHub Releases include the 0.1 beta series in 2016, followed by the 2.x release train that became the standard `az` CLI used from local terminals, CI jobs, containers, and Azure Cloud Shell.

The CLI is implemented as a Python package with command modules for Azure service areas. Microsoft Learn positions it as the primary Azure command-line surface, with configuration under the Azure CLI config directory and first-class documentation for authentication, output formatting, querying, and automation patterns.

### 采用历史

Azure CLI became package-manager furniture because Azure users need the same `az` command on macOS, Linux, Windows, containers, and hosted CI. The input package facts list broad distribution across Homebrew, Chocolatey, Debian, Fedora/DNF, MacPorts, Nix, Arch/pacman, Scoop, winget, and zypper, which matches its role as a cloud bootstrap tool rather than an optional developer convenience.

Its presence in Azure Cloud Shell further normalized `az` as the default examples language for many Azure docs and snippets. Package users care that Homebrew and Linux packages track a large upstream release train and that shell completion, JSON/table/TSV output, and JMESPath querying make it pleasant in scripts.

### 使用方式

Typical usage is `az group create`, `az vm create`, `az storage ...`, `az account get-access-token`, or `az rest`, usually combined with `--query` and `--output` for shell pipelines. The official docs emphasize using `az configure`, environment variables, and the INI-style config file to tune defaults.

Credentials and tokens are stored under the Azure CLI config directory; current source code uses `msal_token_cache` and `service_principal_entries` there. Package maintainers and automation users should treat the directory as sensitive state, especially on shared runners.

### 为什么软件包爱好者会关心

For package nerds, `azure-cli` is a classic heavyweight cloud CLI: fast-moving, Python-based, dependency-rich, and distributed everywhere. It stress-tests package managers on update cadence, Python dependency isolation, shell completion, telemetry defaults, and whether the packaged binary behaves the same as Microsoft's install scripts.

It also demonstrates the difference between a formula that installs a CLI and the hidden state that CLI writes under the user's home directory. Upgrades are routine, but auth caches and config files often outlive package removals.

### 时间线

- 2016: Azure/azure-cli GitHub Releases include the 0.1 beta series.
- 2017: Azure CLI 2.x becomes the public `az` generation for Azure automation.
- 2020s: Azure CLI is broadly packaged across Homebrew, Linux distributions, Windows package managers, and Azure Cloud Shell.

### Related projects

- Azure PowerShell is Microsoft's PowerShell-native Azure automation surface.
- Azure Developer CLI (`azd`) builds on Azure CLI-era workflows with project templates and app deployment conventions.
- Azure Cloud Shell provides a hosted shell environment where Azure CLI is preinstalled.

### 来源

- Azure/azure-cli README and GitHub Releases
- Microsoft Learn Azure CLI overview, authentication, and configuration docs
- source_facts.package-manager


## 安全说明

cloud infrastructure mutation tool.

- **Geiger 风险:** orange / 高
- cloud infrastructure mutation tool


## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Configuration files

- Unix: ~/.azure/config
- Windows: %USERPROFILE%\.azure\config

## Credential files

- Unix: ~/.azure/msal_token_cache.json, ~/.azure/service_principal_entries.json, ~/.azure/accessTokens.json
## 其他软件包管理器记录

- Debian apt - azure-cli - 2.74.0-1: normalized package name match | Debian stable package indexes: azure-cli from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Azure Command-Line Interface (CLI) | https://github.com/Azure/azure-cli
- Debian apt - python3-azure-cli - 2.74.0-1: normalized package name match | Debian stable package indexes: python3-azure-cli from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Azure Command-Line Interface (CLI) - commands modules | https://github.com/Azure/azure-cli
- Debian apt - python3-azure-cli-core - 2.74.0-1: normalized package name match | Debian stable package indexes: python3-azure-cli-core from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Azure Command-Line Interface (CLI) - core modules | https://github.com/Azure/azure-cli
- Debian apt - python3-azure-cli-telemetry - 2.74.0-1: normalized package name match | Debian stable package indexes: python3-azure-cli-telemetry from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Azure Command-Line Interface (CLI) - telemetry modules | https://github.com/Azure/azure-cli
- Debian apt - python3-azure-cli-testsdk - 2.74.0-1: normalized package name match | Debian stable package indexes: python3-azure-cli-testsdk from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Azure Command-Line Interface (CLI) - testsdk modules | https://github.com/Azure/azure-cli
- Nix - azure-cli: normalized package name match | nixpkgs package indexes: pkgs/by-name/az/azure-cli/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- dnf - azure-cli - 2.88.0-2.fc45: normalized package name match | Fedora Rawhide package metadata: azure-cli from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Microsoft Azure Command-Line Tools | https://github.com/Azure/azure-cli
- dnf - python3-azure-cli-core - 2.88.0-2.fc45: normalized package name match | Fedora Rawhide package metadata: python3-azure-cli-core from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Microsoft Azure Command-Line Tools Core Module | https://github.com/Azure/azure-cli
- dnf - python3-azure-cli-telemetry - 2.88.0-2.fc45: normalized package name match | Fedora Rawhide package metadata: python3-azure-cli-telemetry from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Microsoft Azure CLI Telemetry Package | https://github.com/Azure/azure-cli
- dnf - python3-azure-cli-testsdk - 2.88.0-2.fc45: normalized package name match | Fedora Rawhide package metadata: python3-azure-cli-testsdk from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Microsoft Azure CLI SDK testing tools | https://github.com/Azure/azure-cli
- pacman - azure-cli - 2.87.0-1: normalized package name match | Arch Linux sync databases: azure-cli from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | Command-line tools for Microsoft Azure | https://github.com/Azure/azure-cli
- zypper - azure-cli - 2.88.0-1.1: normalized package name match | openSUSE Tumbleweed package metadata: azure-cli from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Microsoft Azure CLI 2.0 | https://github.com/Azure/azure-cli
- MacPorts - azure-cli: normalized package name match | MacPorts ports tree: sysutils/azure-cli/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Chocolatey - azure-cli: normalized package name match | Chocolatey community package catalog: azure-cli from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','authy-desktop'
- Scoop - main/azure-cli: normalized package name match | Scoop official bucket manifest trees: bucket/azure-cli.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1
- winget - Microsoft.AzureCLI: normalized package name match | Windows Package Manager source index: Microsoft.AzureCLI from https://cdn.winget.microsoft.com/cache/source.msix


## Combined YAML source

View the package source record on GitHub. [combined/azure-cli.yml](https://github.com/mxcl/pkgdb/blob/main/combined/azure-cli.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated configuration and credential file locations
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
- curated agent safety answer
