Cannot authenticate from visual studio 2019

TJ Grist 1 Reputation point
2019-12-02T19:14:56.763+00:00

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.

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
22,644 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. neray-MSFT 26 Reputation points
    2019-12-05T08:30:56.943+00:00

    @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.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.