Introducing a new way to review your PRs.

Read the announcement

azure / azure-cli

Azure Command-Line Interface

View on GitHub

13 documents · Updated Nov 16, 2026

overview

Knowledge Base updated: 2026-11-16

Knowledge Base Index

1. Orientation

This repository is azure/azure-cli, the Python implementation of the Azure CLI. The highest-level flow is: a user runs az, the CLI core parses arguments, loads command modules/extensions, invokes SDK-backed command handlers, formats output, and records telemetry.

Main parts:

  • src/azure-cli/ — the az application package and built-in command modules.
  • src/azure-cli-core/ — command runtime, parser, command loader, auth/profile/cloud support, AAZ framework, extension framework, output/logging/errors, and SDK helpers.
  • src/azure-cli-telemetry/ — telemetry event construction and upload support.
  • src/azure-cli-testsdk/ — scenario test framework, recordings, preparers, checkers, and test utilities.
  • scripts/, tools/, build_scripts/, and doc/ — developer automation, release/CI helpers, and authoring/reference documentation.

Critical state is mostly local/client-side:

  • CLI profile, cloud, session, auth, and config state are managed by azure-cli-core helpers under src/azure-cli-core/azure/cli/core/.
  • Extension metadata and installed extensions are managed through the core extension framework under src/azure-cli-core/azure/cli/core/extension/**.
  • Test recordings and scenario-test state are owned by the test SDK and command-module test trees.

2. Architecture diagrams

flowchart TD
  User[User runs az]

  subgraph App[azure-cli package]
    Entrypoints[az / __main__.py]
    Builtins[command_modules]
  end

  subgraph Core[azure-cli-core]
    Runtime[CLI runtime]
    Commands[commands framework]
    Auth[auth profile cloud]
    AAZ[AAZ framework]
    Ext[extension framework]
    TelemetryHook[core telemetry hook]
  end

  subgraph Packages[Supporting packages]
    TelemetryPkg[azure-cli-telemetry]
    TestSDK[azure-cli-testsdk]
  end

  subgraph Azure[External Azure systems]
    ARM[Azure Resource Manager]
    DataPlane[Azure data-plane services]
    Entra[Microsoft Entra ID]
    ExtensionIndex[Extension index]
  end

  User --> Entrypoints
  Entrypoints --> Runtime
  Runtime --> Commands
  Runtime --> Builtins
  Runtime --> Auth
  Runtime --> Ext
  Runtime --> TelemetryHook
  Commands --> AAZ
  Auth --> Entra
  Commands --> ARM
  Commands --> DataPlane
  Ext --> ExtensionIndex
  TelemetryHook --> TelemetryPkg
  TestSDK --> Builtins
sequenceDiagram
  participant User
  participant Entrypoint as az entrypoint
  participant Core as azure-cli-core runtime
  participant Loader as command loader
  participant Module as command module
  participant Azure as Azure service
  participant Telemetry as telemetry

  User->>Entrypoint: az <group> <command> --args
  Entrypoint->>Core: create/invoke CLI
  Core->>Loader: parse and resolve command
  Loader->>Module: load command table, params, validators
  Core->>Module: execute handler
  Module->>Azure: SDK or REST request
  Azure-->>Module: response
  Module-->>Core: result or error
  Core->>Telemetry: record command metadata
  Core-->>User: formatted output/error
flowchart LR
  Cmd[Command handler] --> Profile[Profile/cloud context]
  Profile --> Auth[Authentication stack]
  Auth --> Token[Token/credential]
  Cmd --> ClientFactory[SDK client factory]
  ClientFactory --> ARM[Azure Resource Manager]
  ClientFactory --> DataPlane[Data-plane SDKs]
flowchart TD
  Dev[Developer or CI test] --> TestSDK[azure-cli-testsdk]
  TestSDK --> Scenario[Scenario test base]
  Scenario --> Preparers[Preparers]
  Scenario --> Checkers[Checkers]
  Scenario --> Recording[Recording/playback]
  Scenario --> CLI[az command invocation]
  CLI --> CommandModules[Built-in command modules]

3. Glossary

  • AAZ — Azure CLI's generated command framework under src/azure-cli-core/azure/cli/core/aaz/**.
  • Command module — a built-in Azure CLI product surface under src/azure-cli/azure/cli/command_modules/<module>/.
  • Test SDK — Azure CLI's scenario-test support package under src/azure-cli-testsdk/**.
  • Extension — an out-of-core Azure CLI command package loaded through azure.cli.core.extension and managed by the extension command module.

4. Codebase-wide invariants

  • First-party Python distributions live under src/azure-cli* package roots; representative package metadata files are src/azure-cli/setup.cfg, src/azure-cli-core/setup.cfg, src/azure-cli-testsdk/setup.cfg, and src/azure-cli-telemetry/setup.cfg.
  • Built-in command surfaces are directory-scoped under src/azure-cli/azure/cli/command_modules/<name>/; examples include storage/**, network/**, vm/**, appservice/**, and role/**.
  • Core runtime subsystems are centralized under src/azure-cli-core/azure/cli/core/, with distinct subtrees for commands/**, auth/**, extension/**, aaz/**, and sdk/**.
  • Developer-facing process documentation lives in doc/**, with command authoring and behavior guidance such as doc/authoring_tests.md, doc/extensions/**, and doc/storage_data_plane_commands_auth.md.

5. Routing table