In this Azure tutorial, we will discuss az account show. Along with this, we will also discuss the below topics.
- az login
- az account set
- az account list
Table of Contents
az account show
This is an excellent Azure command that can help you to check the details like tenantId, user name, type, environmentName, homeTenantId, id, state, etc.
In certain scenarios, in case you are running Azure CLI, if you are getting any issue, you can troubleshoot the issue by checking the tenantId, tenant name, etc using the az account show cmdlet.
Once you will run the above command. you will get the output like below
{
"environmentName": "AzureCloud",
"homeTenantId": "5d9d690a-0310-474d-ae8b-42df2d549228",
"id": "1cdf4300-dee5-cccc-9c9c-feaa72a5cbd1",
"isDefault": true,
"managedByTenants": [],
"name": "Visual Studio Enterprise",
"state": "Enabled",
"tenantId": "5d9d690a-cccc-474d-ae8b-ghyf2d549228",
"user": {
"name": "fewlines4biju@hotmail.com",
"type": "user"
}
You can check out the output as below.

If you want to see the output in a table format, you can use the below cmdlet
az account show --output table

Now, if you want to retrieve the account details based on the subscription name, you can use the below cmdlet.
az account show --subscription 'Your subscription name'
Example: In this example, “Visual Studio Enterprise” is the subscription name.
az account show --subscription 'Visual Studio Enterprise'
az login
Log in to Azure using the az login cmdlet. Once you will execute the az login cmdlet, it will prompt you to provide the Azure user name and password or Azure account credentials.
syntax
az login [--allow-no-subscriptions] [--identity] [--password] [--service-principal]
[--tenant] [--use-cert-sn-issuer] [--use-device-code] [--username]
On successful login, it will show you the below pop-up.

az account set
The az account set is an excellent cmdlet that can help you to change your active subscription quickly. When you have multiple active Azure subscriptions. During that time if you wish to set one as the active Azure subscription, this command can help you to fulfill this requirement.
Syntax
The syntax for the az account set cmdlet is as below.
az account set --subscription "Visual Studio Enterprise"
Where “Visual Studio Enterprise” is the name of my active Azure subscription that I want to set as my current active Azure subscription.

az account list
The az account list Azure CLI cmdlet will help you to retrieve the lists of all the accounts associated with that particular user.
az account list
You will get the output like below. Since I have only one account so it is showing only one. I
[
{
"cloudName": "AzureCloud",
"homeTenantId": "5d9d690a-0310-474d-fghh-42df2d556789",
"id": "1cdf4300-dee5-4518-9c9c-tghrii5cbd1",
"isDefault": true,
"managedByTenants": [],
"name": "Visual Studio Enterprise",
"state": "Enabled",
"tenantId": "5d9d690a-0567-474d-ae8b-468575249228",
"user": {
"name": "fewlines4biju@hotmail.com",
"type": "user"
}
}
]
You can see the output below

az subscription
If you want to retrieve the subscription details information you can use the az account cmdlets instead, There is no command called az subscription in Azure CLI. Instead, try executing the command az account list.
If you will try to execute the command az subscription, you will end up with an error message “az : CommandNotFoundError: ‘subscription’ is misspelled or not recognized by the system.”
The complete error message is as below
az : CommandNotFoundError: ‘subscription’ is misspelled or not recognized by the
system.
At line:1 char:1
- az subscription
~~~- CategoryInfo : NotSpecified: (CommandNotFound… by the system.:String
) [], RemoteException - FullyQualifiedErrorId : NativeCommandError
- CategoryInfo : NotSpecified: (CommandNotFound… by the system.:String
Try this: ‘az account list’
Still stuck? Run ‘az –help’ to view all commands or go to
‘https://docs.microsoft.com/en-us/cli/azure/reference-index?view=azure-cli-latest’ to
learn more
So instead, try executing the command az account list.
az set default subscription
If you have multiple Azure subscriptions, you wish to set a default Azure subscription, you can use the below command in Azure CLI.
az account set --subscription 'Your subscription name'
For Example
If your subscription name is ‘Visual Studio Enterprise’, you want to make it the default subscription, you can use the below command in Azure CLI.
az account set --subscription 'Visual Studio Enterprise'

Or, you can also use your subscription ID instead of your Subscription Name like below.
az account set --subscription Your subscription id
For Example
If your subscription id is ‘1cdf4300-xxxxx-4518-fffff-feaa72a5cbd1’, you want to make it the default subscription, you can use the below command in Azure CLI.
az account set --subscription 1cdf4300-xxxxx-4518-fffff-feaa72a5cbd1

This is the way you can use the az account set –subscription command.
You may also like following the below articles
- How to Connect to Azure in PowerShell (And Azure AD)
- How To Install AWS CLI
- Install Azure CLI On Windows
- The term ‘get-azuresubscription’ is not recognized
- The term ‘Select-AzureSubscription’ is not recognized as the name of a cmdlet
- The term ‘Uninstall-AzModule’ is not recognized as the name of a cmdlet
- Why is Azure So Expensive? The Areas You Are Neglecting and Their Solutions
Wrapping Up
Well. in this article we have discussed the az account show. Along with this, we have also discussed the below topics.
- az login
- az account set
- az account list
- az subscription
I hope, you have enjoyed this article !!!