Software⏱️ 3 min read📅 2026-06-11

How to Fix: Azure CLI `AZ LOGIN` ERROR: "Found multiple accounts with the same username"

Fix Azure CLI login error for multiple accounts with same username.

Quick Answer: Set primary account and try logging in again.

The Azure CLI `AZ LOGIN` command has encountered an error when attempting to log in, displaying the message 'Found multiple accounts with the same username'. This issue affects users who have multiple accounts with the same email address and are trying to access their Azure resources.

This error can be frustrating for users as it prevents them from accessing their accounts. In this troubleshooting guide, we will walk through the possible causes of this error and provide steps to resolve the issue.

💡 Why You Are Getting This Error

  • The primary cause of this error is that the user has multiple accounts with the same email address. When the Azure CLI attempts to log in, it displays a list of all accounts with the same username, causing confusion and preventing the user from selecting the correct account.
  • Another possible cause is an outdated or corrupted cache of credentials, which can lead to incorrect login information being displayed.

🔧 Proven Troubleshooting Steps

Resolving the issue by manually selecting the desired account

  1. Step 1: Open a web browser and navigate to the Azure login page. Click on the 'Select Account' dropdown menu and select the PERSONAL account.
  2. Step 2: Enter your personal account credentials and click 'Sign in'. If you are using MFA, ensure that you have completed the required steps to receive the verification code.
  3. Step 3: Once logged in, you can continue with your Azure CLI commands without any issues.

Resolving the issue by clearing the cache and login history

  1. Step 1: Open a new PowerShell prompt and run the `az account clear` command to clear the cache of credentials. This will remove any outdated or corrupted information.
  2. Step 2: Run the `az account set --subscription ` command to update your subscription information. If you are using multiple subscriptions, select the correct one.

✨ Wrapping Up

To resolve the 'Found multiple accounts with the same username' error in Azure CLI, try manually selecting the desired account or clearing the cache and login history. If you continue to experience issues, please report the problem via GitHub: https://github.com/Azure/azure-cli/issues/20168.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions