az-account
Manage Azure subscriptions and account information
TLDR
List all subscriptions for the logged in account
Set a subscription to be the currently active subscription
List supported regions for the currently active subscription
Print an access token to be used with MS Graph API
Print details of the currently active subscription in a specific format
SYNOPSIS
az account { clear | get-access-token | list | list-locations | login | logout | set | show | subscription } [options]
PARAMETERS
--debug
Increase logging verbosity to show all debug logs.
--help (-h)
Show this help message and exit.
--only-show-errors
Only show errors, suppressing warnings.
--output (-o)
Output format: json|jsonc|table|tsv|yaml.
--query
JMESPath query string for output filtering.
--subscription
Name or ID of the target subscription.
--verbose
Increase logging verbosity (use --debug for full logs).
DESCRIPTION
az account is a core command group in the Azure Command-Line Interface (Azure CLI), Microsoft's cross-platform toolset for managing Azure resources from the command line. It handles user authentication, subscription management, and related credentials essential for all Azure operations.
Users can log in via interactive browser flow (az account login), service principals, or managed identities. It lists accessible subscriptions across tenants (az account list), sets the active one (az account set --subscription ID), displays current details (az account show), and supports logout or full credential clearance (az account clear). Additional features include fetching access tokens (az account get-access-token) for API calls and listing resource locations (az account list-locations).
The az account subscription subgroup provides advanced management like creating, deleting, or renaming subscriptions. This command is crucial in multi-subscription setups, CI/CD pipelines, and automation scripts. It integrates with Azure Active Directory (AAD) for secure auth and supports various output formats for scripting. Requires Azure CLI v2.0+ installed via package managers like apt, yum, or brew on Linux.
CAVEATS
Requires Azure CLI installed and internet access for auth. Some subcommands need specific Azure RBAC permissions. Interactive login may fail in headless environments without device code flow.
KEY SUBCOMMANDS
login: Authenticate interactively or via service principal.
list: Show all accessible subscriptions.
set --subscription ID: Switch default subscription.
show: Display active subscription details.
subscription create: Create new subscription (preview features).
COMMON EXAMPLES
az account list --output table
az account login --tenant ID
az account get-access-token --resource https://management.azure.com/
HISTORY
Introduced in Azure CLI 2.0 (2017) by Microsoft as part of cross-platform rewrite from xplat-cli. Evolved with AAD changes, MSAL auth (2020+), and Entra ID rebranding support.


