LinuxCommandLibrary

az-account

Manage Azure subscriptions and access tokens

TLDR

List all subscriptions for the logged-in account

$ az account list
copy
Show the current subscription
$ az account show
copy
Set the active subscription
$ az account set --subscription [subscription-id-or-name]
copy
Get an access token for the current account
$ az account get-access-token
copy
Get an access token for Microsoft Graph
$ az account get-access-token --resource-type ms-graph
copy
List supported regions for the current subscription
$ az account list-locations
copy
Clear all cached subscriptions
$ az account clear
copy

SYNOPSIS

az account subcommand [options]

DESCRIPTION

az account manages Azure subscription information and access tokens. It allows you to list, select, and manage subscriptions associated with your Azure account, as well as obtain access tokens for programmatic access to Azure resources.
This command group is essential for working with multiple Azure subscriptions and switching between them during CLI sessions.

PARAMETERS

--subscription value

Name or ID of the subscription to use
--resource-type value
Type of resource for access token (aad-graph, arm, ms-graph, etc.)
--scope value
Space-separated scopes for the access token
--tenant value
Tenant ID for cross-tenant token requests

SUBCOMMANDS

Subscription Management

list, show, set, clear, list-locations
Access Tokens
get-access-token
Management Groups
management-group create, management-group delete, management-group list, management-group show, management-group update
Locks
lock create, lock delete, lock list, lock show, lock update
Aliases (Extension)
alias create, alias delete, alias list, alias show
Subscriptions (Extension)
subscription list, subscription show

CAVEATS

Access tokens are valid for a minimum of 5 minutes up to a maximum of 60 minutes. The expires_on field in token output is a POSIX timestamp (UTC), while expiresOn is local datetime. Starting in September 2025, Microsoft requires MFA for user identities; scripts should migrate to service principals or managed identities.

SEE ALSO

az(1), az-login(1), az-logout(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community