az account
Manage the signed-in account.
Commands
| Name | Description | Type | Status |
|---|---|---|---|
| az account get-access-token |
Get an access token for the current signed-in context. |
Core | Preview |
az account get-access-token
Get an access token for the current signed-in context.
Acquire an access token from the current signed-in context for a resource, a well-known resource type, or an explicit list of Microsoft Entra scopes. When no target is specified, a token for Azure Resource Manager (ARM) is returned. The token value is redacted by default and is not returned. Pass --plaintext to obtain the raw token value.
az account get-access-token [--plaintext]
[--resource]
[--resource-type {arm, aad-graph, ms-graph, batch, data-lake, oss-rdbms, media, key-vault, storage, synapse, managed-hsm, communication-email, attestation, app-configuration, analysis-services, operational-insights}]
[--scope]
[--tenant-id]
Examples
Get an access token for Azure Resource Manager (the default target)
az account get-access-token
Get an access token for a well-known resource type
az account get-access-token --resource-type ms-graph
Get an access token for a specific resource URL
az account get-access-token --resource https://vault.azure.net
Get an access token for an explicit list of scopes
az account get-access-token --scope https://graph.microsoft.com/.default
Print the raw access token as plain text
az account get-access-token --plaintext
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Emit the raw access token as plain text. By default the token is redacted in output.
Resource URL (v1.0) to acquire the token for. Mutually exclusive with --resource-type and --scope.
Well-known resource type shortcut (e.g. arm, ms-graph, key-vault). Mutually exclusive with --resource and --scope.
| Property | Value |
|---|---|
| Accepted values: | arm, aad-graph, ms-graph, batch, data-lake, oss-rdbms, media, key-vault, storage, synapse, managed-hsm, communication-email, attestation, app-configuration, analysis-services, operational-insights |
One or more Microsoft Entra v2.0 scopes. Mutually exclusive with --resource and --resource-type.
Tenant ID to acquire the token for. Defaults to the current profile's tenant.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.