Cannot authenticate from visual studio 2019

TJ Grist 1 Reputation point

I am remoting into a Windows server 2012 machine. I can authenticate the acct from a browser (chrome) and login to Azure devops. However when I try to login via Visual Studio I get the following error:

We could not add the account AADSTS51004: The user account does not exist in the directory. To sign into this application, the account must be added to the directory. Trace ID ba621e6d-e6fc-4ac5-80c6-1abffab60d00 Correlation ID: a0573630-a419-41a4-9ac0-e247a43c7c1a Timestamp: 2019-12-02 18:26:16Z

When I examine the directory in question, the acct appears to already be in the directory.

Azure Active Directory
Azure Active Directory
An Azure enterprise identity service that provides single sign-on and multi-factor authentication.
12,774 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. neray-MSFT 26 Reputation points

    @TJ Grist

    The error message states that the account is not not in the tenant when you are trying to sign in from the Visual Studio 2019.

    This is what I believe could be happening - when you are signing in from the browser you are logging in to a tenant, lets say Tenant 2.
    However, when you are in Visual Studio it is generally where you are working on your Azure Resources. So the tenant which the Subscription, lets say Subscription 1, is associated with would be a different tenant, like Tenant 1.

    So here's what I suggest - when you login to the browser, check if you are able to view the Azure Resources (without changing the directory). If not, use an account credential from the Tenant associated with the Subscription and try again.


    Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members.

    No comments