0

I'm getting this error whenever I try to login to Azure via the CLI. Here are the details:

PS C:\Users\MyName> az login  
Please select the account you want to log in with  

(Now I get a popup browser window where both accounts have the same username/email):
enter image description here

Found multiple accounts with the same username 'me@<redacted>.com': [{'home_account_id': 
'00000000-0000-0000-8413-<redacted>.9188040d-6c67-4c5b-b112-<redacted>', 'environment': 
'login.microsoftonline.com', 'username': 'me@<redacted>.com', 'authority_type': 'MSSTS',
 'local_account_id': 'ff37078a-25ee-4ca8-a555-<redacted>', 'realm': '2c5b6192-50ca-4e45-
869a-<redacted>'}, {'home_account_id': 'cd1796cb-a338-4267-8b6e-<redacted>.1a8ba571-a143
-461a-aac3-<redacted>', 'environment': 'login.microsoftonline.com', 'username':  'me@<re
dacted>.com', 'authority_type': 'MSSTS', 'local_account_id': 'cd1796cb-a338-4267-8b6e-<r
edacted>', 'realm': 'organizations'}]  
Please report to us via Github: https://github.com/Azure/azure-cli/issues/20168
  1. The 2nd account (PERSONAL) is the one I am interested in using
  2. I have tried:
    1. logging in multiple times -- NO GO
    2. the az account clear command from the PS prompt (to clear the cache) -- NO GO
    3. checked to see if I am missing an MFA on my phone -- NO GO
    4. logging out via az logout and then logging back in via az login -- NO GO

1 Answer 1

0

I think I solved this...

  1. I logged into the portal directly at portal.azure.com
  2. I clicked on Azure Active Directory (soon to be Microsoft Entra ID)
  3. I clicked on Manage Tenants enter image description here
  4. This brings you to the default tenant, and there listed to the right of "tenant" is the tenant ID... you can copy that by clicking on the "copy icon"enter image description here
  5. go back to the Azure CLI command prompt (either windows command prompt or powershell) and type az login --tenant <your-tenant-id>
  6. you will get the BROWSER POPUP asking for the account you want to log in with, choose the correct account that holds your Azure subscription(s).
  7. if you still have a problem try az login --tenant <your-tenant-id> --use-device-code which will force the browser to login using a code that the az login command prompt will supply in the command-line interface, which you then will enter into the browser (kind of like an MFA but pushed from the "device" [in this case your PC's command-line]).
  8. this should log you in and list all subscriptions in your Microsoft Account which is the default behavior.
  9. execute az logout and then log back in via az login (without any options/switches this time) and from this point forward this should be "fixed"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .