Changing TFS credentials in Visual Studio 2012

An error you might bump into is trying to connect to a TFS service and getting an access denied with the message “TF31003: Either you have not entered the necessary credentials or your user account does not have permission…”.


Delete all saved passwords in your IE browsing history, as described in this MSDN forum thread.


The IE-clearing-tip above often works, when it does not – I have to hit “TEAM – CONNECT TO TFS…” in VS again, that gives me the credentials prompt.

The long story

I have had this problem on several occasions before, but only today had the willpower to look up the solution Smile

The problem

A partner created a TFS (Team Foundation Service) instance in the cloud and shared with my live ID (=Microsoft Account). When trying to connect to the TFS instance, I was not asked for credentials but instead just nicely greeted with an error message that I did not have enough permission.

The probable cause

I often log in to Microsoft sites as different users; our company partner ID, a customer’s ID to publish apps etc. Somewhere, somehow, the system caches these different credentials and tries to use one of them when logging in to TFS via Visual Studio.

My first attempt at a solution

I first tried the solution suggested here: to delete accounts from the Credentials Manager. Did not work for me.

The solution that worked

As suggested in this MSDN forum thread, simply clearing the IE stored passwords did the trick! Connecting to TFS from Visual Studio after this prompted me for credentials and boom – I was in.


Happy TFS-ing!

/Andreas Hammar

This Post Has 17 Comments

  1. Cheng

    Thanks man! I’ve searched and tried different procedures but this is the only one that works!! tnx again.

  2. Andreas Hammar

    Glad to have helped! Bugged the h**l out of me too :)

    I use many different browsers when logging in to live as other users – to not mess with the IE login.

  3. Julian Dominguez

    Hi Andreas, great tip.
    I’ve looked into this a little bit more, as I hate having to delete all of my cookies just to get TFS working.
    I’ve found out that I only have to delete these 3 cookies:

    You can find all the cookies at: C:Users\AppDataLocalMicrosoftWindowsTemporary Internet Files

    1. Andreas Hammar

      Hi Julian!

      Thanks for that, nice to not have to clear all cookies.

      I’ve also had success with the following:
      – opening the browser in Visual Studio
      – logging out and logging in again
      – re-connecting to the TFS server

      The last part is important, it seems to lose the connection. (It says that ‘access denied to XX’, where XX is correct, but still doesn’t work)

  4. Dan

    Thanks, this worked for me !

  5. Sebastien

    You can also run command: rundll32.exe keymgr.dll,KRShowKeyMgr

    Then delete your credentials from the list.

    1. Q

      This is the best answer for me. Thank you.

  6. Dominic

    Wow, thank you so SO much! I’ve been dealing with trying to change the credentials for over an hour since I set-up 2 step authentication and VS decided to not let me input my new details.

  7. sumit

    Thanks mate !! i was really stuck in this problem for long !! cheers

  8. Daniel

    I’ve been searching on the net for like a week and I got no where.
    I can’t believe the solution was as unrelated as that.

  9. Brett

    Works great for me! Thanks man

  10. Alfi

    very helpfull.. awesome

  11. Berkan

    Thx, great tips. Also , opening an internal browser in visual studio and logging out from , then try to connect tfs from that internal browser also works. (for people who doesn’t want to clear cookies ;) )

    1. Andreas Hammar

      Thanks for telling us Berkan – I haven’t tried it myself but always good to have multiple ways of fixing.

  12. Mosh

    Thanks! Simple solution for Hard problem :)

Leave a Reply