Is Visual Studio continually prompting you to sign into your Microsoft account (sometimes failing), even though the information is correct?
You can find the logs in %USERPROFILE%\AppData\Local\Temp\servicehub\logs to see more information.
Inside those logs, there can be various messages, but many should be similar to "Problem Acquiring a token".
Example
01/31/2018 09:20:22 : Error : Problem Acquiring a token silenly for resource: 'https://graph.windows.net/', tenant:'00000-00000-00000-00000', User: '1_asdlkB40309asldqsd1234asdfas21a1234' due to 'Microsoft.IdentityService.Clients.ActiveDirectory.AdalException: multiple_matching_tokens_detected: The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more arguments (e.g. UserId) at Microsoft.IdentityService.Clients.ActiveDirectory.TokenCache.LoadSingleItemFromCache(CacheQueryData cacheQueryData, CallState callState) at Microsoft.IdentityService.Clients.ActiveDirectory.TokenCache.LoadFromCache(CacheQueryData cacheQueryData, CallState callState) at Microsoft.IdentityService.Clients.ActiveDirectory.AcquireTokenHandlerBase.d__55.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.IdentityService.Clients.ActiveDirectory.AuthenticationContext.d__57.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.IdentityService.Clients.ActiveDirectory.AuthenticationContext.d__41.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Developer.IdentityService.AccountProvider.NetworkServicesImpl.d__8.MoveNext() ErrorCode: multiple_matching_tokens_detected'
After searching and trying a ton of solutions, I found the one that should work for every issue related to acquiring tokens in Visual Studio.
The Solution
Close all instances of Visual Studio and delete the folder %LOCALAPPDATA%\.IdentityService
The next time you open Visual Studio your sign-in with your Microsoft Account should be successful.
Original Source:
https://developercommunity.visualstudio.com/content/problem/17315/cant-add-new-account-with-vsts-online-failed-to-re.html