-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Bug Report: Azure CLI throws “Found multiple accounts with the same username” error Command/Context #32424
Copy link
Copy link
Closed
Labels
Accountaz login/accountaz login/accountAuto-AssignAuto assign by botAuto assign by botAuto-ResolveAuto resolve by botAuto resolve by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamThe command of the issue is owned by Azure CLI teamOKR CandidateThis label is used to track how many GitHub issues we have resolved for OKR purpose.This label is used to track how many GitHub issues we have resolved for OKR purpose.Possible-SolutionSimilar-Issuecustomer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Milestone
Metadata
Metadata
Assignees
Labels
Accountaz login/accountaz login/accountAuto-AssignAuto assign by botAuto assign by botAuto-ResolveAuto resolve by botAuto resolve by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamThe command of the issue is owned by Azure CLI teamOKR CandidateThis label is used to track how many GitHub issues we have resolved for OKR purpose.This label is used to track how many GitHub issues we have resolved for OKR purpose.Possible-SolutionSimilar-Issuecustomer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Describe the bug
Found multiple accounts with the same username '': [
{
'home_account_id': '',
'environment': 'login.microsoftonline.com',
'username': '',
'account_source': 'urn:ietf:params:oauth:grant-type:device_code',
'authority_type': 'MSSTS',
'local_account_id': '',
'realm': 'organizations'
},
{
'home_account_id': '',
'environment': 'login.microsoftonline.com',
'username': '',
'account_source': 'urn:ietf:params:oauth:grant-type:device_code',
'authority_type': 'MSSTS',
'local_account_id': '',
'realm': ''
}
]
Related command
az login --use-device-code --tenant
Errors
Found multiple accounts with the same username
Issue script & Debug output
When attempting to authenticate using Azure CLI with device-code login, the CLI fails with an error stating that multiple accounts with the same username were found. The login process stops instead of allowing the user to select a tenant or continuing normally.
This occurs even in a clean environment with no existing Azure CLI profile.
Expected behavior
Expected Behavior
Azure CLI should either:
successfully authenticate, or
allow the user to choose which account/tenant to use, or
automatically handle users that exist across multiple tenants.
Actual Behavior
Login fails with an error and does not allow the user to proceed.
Steps to Reproduce
Run az login --use-device-code
Complete authentication in the browser
CLI throws the above error and login does not complete
Environment
OS: (e.g., Windows / macOS / Linux)
Azure CLI version: (az version)
No custom configuration
Additional Notes
Deleting the Azure profile folder (e.g., ~/.azure/) and re-logging does not resolve the issue.
The error happens even on a clean environment.
Environment Summary
azure-cli 2.76.0 *
core 2.76.0 *
telemetry 1.1.0
Dependencies:
msal 1.33.0b1
azure-mgmt-resource 23.3.0
Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Config directory 'C:\Users\jefer.azure'
Extensions directory 'C:\Users\jefer.azure\cliextensions'
Python (Windows) 3.12.10 (tags/v3.12.10:0cc8128, Apr 8 2025, 12:21:36) [MSC v.1943 64 bit (AMD64)]
Legal docs and information: aka.ms/AzureCliLegal
Additional context
No response