Problem to log in to Azure from Visual Studio

I’ve been meddling around with Azure for a while now. As I do it both in my daytime job and as a hobby in evenings and weekends and I like to keep my accounts separate I’m bound to end up with a couple of them.

I recently ran into a problem that I think is related to having multiple accounts associated with my Visual Studio 2017. In the cloud explorer it failed to load my subscriptions, Visual Studio also failed to sign in to the Visual Studio profile. I just kept getting the account authentication screen asking for my password again and again and it seemed like I entered the correct password each time.

A frustrating evening of searching the net for the cause of this weird behavior finally gave me the insight to check out the service hub logs, what is service hub – I have no idea, but the logs are kept in “%LOCALAPPDATA%/Temp/servicehub/log”.

There where multiple files there, but the most recent contained, among many others,  a line indicating ”

“multiple_matching_tokens_detected: The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more arguments (e.g. UserId)””

Googling that immediately gave me a suggestion:

1. Close all Visual Studio instances.

2. Delete %LOCALAPPDATA%\.IdentityService.

3. Enjoy.

From <https://developercommunity.visualstudio.com/content/problem/17315/cant-add-new-account-with-vsts-online-failed-to-re.html>

So I closed down Visual Studio, deleted the folder and started up again. Everything worked like a charm!