Skip to content

Issues with az login when your email address has both an Entra ID and a MS account tied to it #31156

Description

@TimAbmgf

Describe the bug

I originally hosted my domains email (pre-Exchange Online) using MS Small business server. At that time we were able to use those email addresses to create MS accounts (for services like OneDrive\Messenger..other MS services).
Then I migrated my systems to Azure. Probably a couple years after that, no new mailbox tied to our domain can be used to make a new MS account.

If I try to use any new email address from our domain this is the error:
Create account
You can't sign up here with a work or school email address. Use a personal email, such as Gmail or Yahoo!, or get a new Outlook email.

So now, here is my issue....
When I am using az login the UI to select which account I want to use comes up properly.
The auth works properly as well.

However, the problem then is PowerShell errors with:
Found multiple accounts with the same username

I can see the 2 accounts tied to the same email address. however, the end of each account shows the difference.
one ends with:

  1.   'realm': '77b1a388-5gws-492g-ga42-64wfa087g04a'}, 
    
  2.   'realm': 'organizations'}]
    

In the #1 bullet above I changed the characters for privacy.

I got the URL within PowerShell to report this here:
Please report to us via Github: #20168

Related command

az login

Errors

You can't sign up here with a work or school email address. Use a personal email, such as Gmail or Yahoo!, or get a new Outlook email.

Issue script & Debug output

cli.azure.cli.core.azclierror: Found multiple accounts with the same username 'john.doe@microsoft.com': [{'home_account_id': '2892c001-fae1-44d7-988e-4407b35d70b9.4c6414b7-e019-4b42-b37f-795af00707d5', 'environment': 'login.microsoftonline.com', 'username': 'john.doe@microsoft.com', 'account_source': 'broker', 'authority_type': 'MSSTS', 'local_account_id': '71d92c9d-9ec1-4ffc-9f68-912fe441ac18', 'realm': '77a1b388-5acf-492b-bf42-64cbb087d04c'}, {'home_account_id': '00000000-0000-0000-6cae-0abe7c6aaad1.9188040d-6c67-4c5b-b112-36a304b66dad', 'environment': 'login.microsoftonline.com', 'username': 'john.doe@microsoft.com', 'account_source': 'broker', 'authority_type': 'MSSTS', 'local_account_id': '00000000-0000-0000-6cae-0abe7c6aaad1.9188040d-6c67-4c5b-b112-36a304b66dad.f8cdef31-a31e-4b4a-93e4-5f571e91255a', 'realm': 'organizations'}]
Please report to us via Github: #20168
az_command_data_logger: Found multiple accounts with the same username 'john.doe@microsoft.com': [{'home_account_id': '2892c001-fae1-44d7-988e-4407b35d70b9.4c6414b7-e019-4b42-b37f-795af00707d5', 'environment': 'login.microsoftonline.com', 'username': 'john.doe@microsoft.com', 'account_source': 'broker', 'authority_type': 'MSSTS', 'local_account_id': '71d92c9d-9ec1-4ffc-9f68-912fe441ac18', 'realm': '77a1b388-5acf-492b-bf42-64cbb087d04c'}, {'home_account_id': '00000000-0000-0000-6cae-0abe7c6aaad1.9188040d-6c67-4c5b-b112-36a304b66dad', 'environment': 'login.microsoftonline.com', 'username': 'john.doe@microsoft.com', 'account_source': 'broker', 'authority_type': 'MSSTS', 'local_account_id': '00000000-0000-0000-6cae-0abe7c6aaad1.9188040d-6c67-4c5b-b112-36a304b66dad.f8cdef31-a31e-4b4a-93e4-5f571e91255a', 'realm': 'organizations'}]
Please report to us via Github: #20168

Expected behavior

the account selected through the UI actually gets used/referenced within PowerShell

Environment Summary

PS C:\Users\tima> az version
{
"azure-cli": "2.63.0",
"azure-cli-core": "2.63.0",
"azure-cli-telemetry": "1.1.0",
"extensions": {
"ssh": "2.0.6",
"stack-hci-vm": "1.4.3"
}
}

Additional context

No response

Metadata

Metadata

Assignees

Labels

Accountaz login/accountAuto-AssignAuto assign by botAuto-ResolveAuto resolve by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamPossible-SolutionSimilar-Issueact-identity-squadcustomer-reportedIssues 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 that

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions