How to get the currently logged-in user account with Azure CLI in PowerShell?

PowerShellMicrosoft TechnologiesSoftware & Coding

To get the connected user account with the Azure CLI, you need to use the below command.

PS C:\> az account show

Once you type the command, you will get the output in JSON format as shown below.

PS C:\> az account show
   "environmentName": "AzureCloud",
   "homeTenantId": "Your tenant ID",
   "id": "Subscriptio ID",
   "isDefault": true,
   "managedByTenants": [],
   "name": "Subscription Name",
   "state": "Enabled",
   "tenantId": "tenant ID",
   "user": {
    "name": "user logged in email id or username",
    "type": "user"

To get the output in the table format, use the -otable or –output table

PS C:\> az account show -otable
Updated on 01-Sep-2021 09:35:09