← 返回命令列表

Linux command

az-account 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

List all subscriptions

az account list

Show the current subscription

az account show

Set the active subscription

az account set --subscription [subscription-id-or-name]

Get an access token

az account get-access-token

Get an access token

az account get-access-token --resource-type ms-graph

List all subscriptions

az account list --all

List supported regions

az account list-locations

Clear all cached subscriptions

az account clear

说明

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.

参数

--subscription, -s _value_
Name or ID of the subscription to use (accepted by `set`, `show`, `get-access-token`)
--all
(`list`) Include subscriptions from all clouds and all states, not just enabled ones.
--refresh
(`list`) Retrieve up-to-date subscriptions from the server rather than local cache.
--resource-type _value_
Type of resource for access token. Accepted values: aad-graph, arm, batch, data-lake, media, ms-graph, oss-rdbms.
--resource _uri_
Azure resource endpoint URI for access token (Microsoft Entra v1.0).
--scope _value_
Space-separated scopes for the access token (Microsoft Entra v2.0). Defaults to Azure Resource Manager.
--tenant, -t _value_
Tenant ID for cross-tenant token requests. Only available for user and service principal accounts.

FAQ

What is the az-account command used for?

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.

How do I run a basic az-account example?

Run `az account list` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --subscription, -s _value_ do in az-account?

Name or ID of the subscription to use (accepted by `set`, `show`, `get-access-token`)