Share via


az account

Note

This command group has commands that are defined in both Azure CLI and at least one extension. Install each extension to benefit from its extended capabilities. Learn more about extensions.

Manage Azure subscription information.

Commands

Name Description Type Status
az account accept-ownership-status

Accept subscription ownership status.

Extension GA
az account alias

Manage subscription alias.

Extension GA
az account alias create

Create Alias Subscription.

Extension GA
az account alias delete

Delete Alias.

Extension GA
az account alias list

List Alias Subscriptions.

Extension GA
az account alias show

Get Alias Subscription.

Extension GA
az account alias wait

Place the CLI in a waiting state until a condition of the account alias is met.

Extension GA
az account clear

Clear all subscriptions from the CLI's local cache.

Core GA
az account create

Create a subscription.

Extension Preview
az account get-access-token

Get a token for utilities to access Azure.

Core GA
az account list

Get a list of subscriptions for the logged in account. By default, only 'Enabled' subscriptions from the current cloud is shown.

Core GA
az account list-locations

List supported regions for the current subscription.

Core GA
az account lock

Manage Azure subscription level locks.

Core GA
az account lock create

Create a subscription lock.

Core GA
az account lock delete

Delete a subscription lock.

Core GA
az account lock list

List lock information in the subscription.

Core GA
az account lock show

Show the details of a subscription lock.

Core GA
az account lock update

Update a subscription lock.

Core GA
az account management-group

Manage Azure Management Groups.

Core GA
az account management-group check-name-availability

Check if a Management Group Name is Valid.

Core GA
az account management-group create

Create a new management group.

Core GA
az account management-group delete

Delete an existing management group.

Core GA
az account management-group entities

Entity operations (Management Group and Subscriptions) for Management Groups.

Core GA
az account management-group entities list

List all entities for the authenticated user.

Core GA
az account management-group hierarchy-settings

Provide operations for hierarchy settings defined at the management group level. Settings can only be set on the root Management Group of the hierarchy.

Core GA
az account management-group hierarchy-settings create

Create hierarchy settings defined at the Management Group level.

Core GA
az account management-group hierarchy-settings delete

Delete the hierarchy settings defined at the Management Group level.

Core GA
az account management-group hierarchy-settings list

Get all the hierarchy settings defined at the Management Group level.

Core GA
az account management-group hierarchy-settings update

Update the hierarchy settings defined at the Management Group level.

Core GA
az account management-group list

List all management groups in the current tenant.

Core GA
az account management-group show

Get the details of the management group.

Core GA
az account management-group subscription

Subscription operations for Management Groups.

Core GA
az account management-group subscription add

Add a subscription to a management group.

Core GA
az account management-group subscription remove

Remove an existing subscription from a management group.

Core GA
az account management-group subscription show

Show the details of a subscription under a known management group.

Core GA
az account management-group subscription show-sub-under-mg

Get the subscription under a management group.

Core GA
az account management-group tenant-backfill

Backfill Tenant Subscription Operations for Management Groups.

Core GA
az account management-group tenant-backfill get

Get the backfill status for a tenant.

Core GA
az account management-group tenant-backfill start

Start backfilling subscriptions for a tenant.

Core GA
az account management-group update

Update an existing management group.

Core GA
az account set

Set a subscription to be the current active subscription.

Core GA
az account show

Get the details of a subscription.

Core GA
az account subscription

Manage subscriptions.

Extension Experimental
az account subscription cancel

Cancel subscription.

Extension Experimental
az account subscription enable

Enable subscription.

Extension Experimental
az account subscription list

Get all subscriptions for a tenant.

Extension Experimental
az account subscription list-location

This operation provides all the locations that are available for resource providers; however, each resource provider may support a subset of this list.

Extension Experimental
az account subscription rename

Rename subscription.

Extension Experimental
az account subscription show

Get details about a specified subscription.

Extension Experimental
az account tenant

Manage tenant.

Extension Experimental
az account tenant list

Get the tenants for your account.

Extension Experimental

az account accept-ownership-status

Accept subscription ownership status.

az account accept-ownership-status --subscription-id

Required Parameters

--subscription-id

Subscription Id. Required.

Global 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.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az account clear

Clear all subscriptions from the CLI's local cache.

To clear the current subscription, use 'az logout'.

az account clear
Global 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.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az account create

Preview

This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Create a subscription.

az account create --enrollment-account-name
                  --offer-type {MS-AZR-0017P, MS-AZR-0148P, MS-AZR-USGOV-0015P, MS-AZR-USGOV-0017P, MS-AZR-USGOV-0148P}
                  [--display-name]
                  [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                  [--owner-object-id]
                  [--owner-spn]
                  [--owner-upn]

Required Parameters

--enrollment-account-name --enrollment-account-object-id

The name of the enrollment account to which the subscription will be billed.

--offer-type

The offer type of the subscription. For example, MS-AZR-0017P(EnterpriseAgreement) and MS-AZR-0148P(EnterpriseAgreement devTest) are available. Allowed values: MS-AZR-0017P, MS-AZR-0148P, MS-AZR-USGOV-0015P, MS-AZR-USGOV-0017P, MS-AZR-USGOV-0148P.

Accepted values: MS-AZR-0017P, MS-AZR-0148P, MS-AZR-USGOV-0015P, MS-AZR-USGOV-0017P, MS-AZR-USGOV-0148P

Optional Parameters

--display-name

The display name of the subscription.

--no-wait

Do not wait for the long-running operation to finish.

Accepted values: 0, 1, f, false, n, no, t, true, y, yes
--owner-object-id

The object id(s) of the owner(s) which should be granted access to the new subscription.

--owner-spn

The service principal name(s) of the owner(s) which should be granted access to the new subscription.

--owner-upn

The user principal name(s) of owner(s) who should be granted access to the new subscription.

Global 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.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az account get-access-token

Get a token for utilities to access Azure.

The token will be valid for at least 5 minutes with the maximum at 60 minutes. If the subscription argument isn't specified, the current account is used.

In the output, expires_on represents a POSIX timestamp and expiresOn represents a local datetime. It is recommended for downstream applications to use expires_on because it is in UTC.

az account get-access-token [--name]
                            [--resource]
                            [--resource-type {aad-graph, arm, batch, data-lake, media, ms-graph, oss-rdbms}]
                            [--scope]
                            [--tenant]

Examples

Get an access token for the current account

az account get-access-token

Get an access token for a specific subscription

az account get-access-token --subscription 00000000-0000-0000-0000-000000000000

Get an access token for a specific tenant

az account get-access-token --tenant 00000000-0000-0000-0000-000000000000

Get an access token to use with MS Graph API

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

Optional Parameters

--name --subscription -n -s

Name or ID of subscription.

--resource

Azure resource endpoints in AAD v1.0.

--resource-type

Type of well-known resource.

Accepted values: aad-graph, arm, batch, data-lake, media, ms-graph, oss-rdbms
--scope

Space-separated AAD scopes in AAD v2.0. Default to Azure Resource Manager.

--tenant -t

Tenant ID for which the token is acquired. Only available for user and service principal account, not for MSI or Cloud Shell account.

Global 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.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az account list

Get a list of subscriptions for the logged in account. By default, only 'Enabled' subscriptions from the current cloud is shown.

az account list [--all]
                [--refresh]

Optional Parameters

--all

List all subscriptions from all clouds, rather than just 'Enabled' ones.

Default value: False
--refresh

Retrieve up-to-date subscriptions from server.

Default value: False
Global 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.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az account list-locations

List supported regions for the current subscription.

az account list-locations [--include-extended-locations {0, 1, f, false, n, no, t, true, y, yes}]

Optional Parameters

--include-extended-locations

Whether to include extended locations.

Accepted values: 0, 1, f, false, n, no, t, true, y, yes
Global 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.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az account set

Set a subscription to be the current active subscription.

az account set --name

Required Parameters

--name --subscription -n -s

Name or ID of subscription.

Global 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.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az account show

Get the details of a subscription.

If the subscription isn't specified, shows the details of the default subscription.

az account show [--name]

Optional Parameters

--name --subscription -n -s

Name or ID of subscription.

Global 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.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.