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/— theazapplication 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/, anddoc/— 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-corehelpers undersrc/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.extensionand managed by theextensioncommand module.
4. Codebase-wide invariants
- First-party Python distributions live under
src/azure-cli*package roots; representative package metadata files aresrc/azure-cli/setup.cfg,src/azure-cli-core/setup.cfg,src/azure-cli-testsdk/setup.cfg, andsrc/azure-cli-telemetry/setup.cfg. - Built-in command surfaces are directory-scoped under
src/azure-cli/azure/cli/command_modules/<name>/; examples includestorage/**,network/**,vm/**,appservice/**, androle/**. - Core runtime subsystems are centralized under
src/azure-cli-core/azure/cli/core/, with distinct subtrees forcommands/**,auth/**,extension/**,aaz/**, andsdk/**. - 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
-
src/azure-cli/az,src/azure-cli/az.bat, src/…/az.completion.sh,src/azure-cli/azps.ps1-> docs/cli-application-entrypoints.md -
src/azure-cli/setup.cfg,src/azure-cli/README.rst, src/…/pyproject.toml -> docs/cli-application-entrypoints.md -
src/azure-cli-core/azure/cli/core/commands/**-> docs/core-runtime-invocation.md -
src/azure-cli-core/azure/cli/core/profiles/**-> docs/core-runtime-invocation.md -
src/azure-cli-core/setup.cfg,src/azure-cli-core/README.rst, src/…/pyproject.toml -> docs/core-runtime-invocation.md -
any change to CLI parsing, command invocation, output formatting, logging, debug behavior, or core error handling -> docs/core-runtime-invocation.md
-
src/azure-cli-core/azure/cli/core/auth/**-> docs/core-auth-profile-cloud.md -
src/azure-cli-core/azure/cli/core/sdk/**-> docs/core-auth-profile-cloud.md -
src/…/credential_helper.py -> docs/core-auth-profile-cloud.md
-
src/azure-cli/azure/cli/command_modules/profile/**-> docs/core-auth-profile-cloud.md -
src/azure-cli/azure/cli/command_modules/cloud/**-> docs/core-auth-profile-cloud.md -
any change to login/account/profile/cloud selection, credential creation, or SDK client authentication -> docs/core-auth-profile-cloud.md
-
src/azure-cli-core/azure/cli/core/extension/**-> docs/core-extension-management.md -
src/azure-cli/azure/cli/command_modules/extension/**-> docs/core-extension-management.md -
doc/extensions/**-> docs/core-extension-management.md -
any change to extension discovery, install/update/remove, dynamic install, or extension index handling -> docs/core-extension-management.md
-
src/azure-cli-core/azure/cli/core/aaz/**-> docs/core-aaz-command-framework.md -
doc/track_2_migration_guidance.md -> docs/core-aaz-command-framework.md
-
doc/track_2_migration_roadmap.md -> docs/core-aaz-command-framework.md
-
any change to generated AAZ command models, AAZ argument/action/update primitives, or AAZ client/request handling -> docs/core-aaz-command-framework.md
-
src/azure-cli-telemetry/**-> docs/telemetry-package.md -
doc/telemetry/**-> docs/telemetry-package.md -
any change to telemetry event construction, telemetry components, upload behavior, or command telemetry integration -> docs/telemetry-package.md
-
src/azure-cli-testsdk/**-> docs/testsdk-scenario-framework.md -
tests/agent_tools/**-> docs/testsdk-scenario-framework.md -
doc/authoring_tests.md -> docs/testsdk-scenario-framework.md
-
any change to scenario-test recording/playback, preparers, checkers, decorators, or reverse-dependency test tooling -> docs/testsdk-scenario-framework.md
-
src/azure-cli/azure/cli/command_modules/resource/**-> docs/resource-role-policy-commands.md -
src/azure-cli/azure/cli/command_modules/role/**-> docs/resource-role-policy-commands.md -
src/azure-cli/azure/cli/command_modules/identity/**-> docs/resource-role-policy-commands.md -
src/azure-cli/azure/cli/command_modules/policyinsights/**-> docs/resource-role-policy-commands.md -
src/azure-cli/azure/cli/command_modules/managedservices/**-> docs/resource-role-policy-commands.md -
src/azure-cli/azure/cli/command_modules/marketplaceordering/**-> docs/resource-role-policy-commands.md -
doc/managed_identity_command_guideline.md -> docs/resource-role-policy-commands.md
-
any change to ARM resource CRUD, RBAC/role assignments, managed identity commands, policy insights commands, or marketplace ordering commands -> docs/resource-role-policy-commands.md
-
src/azure-cli/azure/cli/command_modules/vm/**-> docs/compute-vm-commands.md -
src/azure-cli/azure/cli/command_modules/compute_recommender/**-> docs/compute-vm-commands.md -
src/azure-cli/azure/cli/command_modules/computefleet/**-> docs/compute-vm-commands.md -
src/azure-cli/azure/cli/command_modules/sqlvm/**-> docs/compute-vm-commands.md -
any change to VM, compute recommendation, compute fleet, or SQL VM command behavior -> docs/compute-vm-commands.md
-
src/azure-cli/azure/cli/command_modules/network/**-> docs/network-dns-commands.md -
src/azure-cli/azure/cli/command_modules/privatedns/**-> docs/network-dns-commands.md -
doc/private_endpoint_connection_command_guideline.md -> docs/network-dns-commands.md
-
any change to networking, private DNS, private endpoint connection behavior, or network command validators/custom handlers -> docs/network-dns-commands.md
-
src/azure-cli/azure/cli/command_modules/storage/**-> docs/storage-commands.md -
doc/storage_data_plane_commands_auth.md -> docs/storage-commands.md
-
any change to Storage management-plane commands, blob/file/queue/table data-plane commands, transfer/batch helpers, or storage auth modes -> docs/storage-commands.md
-
src/azure-cli/azure/cli/command_modules/appservice/**-> docs/app-hosting-container-commands.md -
src/azure-cli/azure/cli/command_modules/containerapp/**-> docs/app-hosting-container-commands.md -
src/azure-cli/azure/cli/command_modules/container/**-> docs/app-hosting-container-commands.md -
src/azure-cli/azure/cli/command_modules/acs/**-> docs/app-hosting-container-commands.md -
src/azure-cli/azure/cli/command_modules/acr/**-> docs/app-hosting-container-commands.md -
src/azure-cli/azure/cli/command_modules/serviceconnector/**-> docs/app-hosting-container-commands.md -
src/azure-cli/azure/cli/command_modules/botservice/**-> docs/app-hosting-container-commands.md -
any change to App Service, Container Apps, Container Instances, AKS/ACS, ACR, Service Connector, or Bot Service commands -> docs/app-hosting-container-commands.md