Question

Update I managed to solve it by getting my user granted permissions to remotely connect to the desktop using credential set 2 and thus being able to remove the stored credentials from Credential Manager.


I log onto my server with one set of credentials and open Visual Studio 2012 using "Run as different user" (Shift + Right-click) as I need a second set of credentials to deploy to my dev. env. SharePoint site.

I have previously done above and then connected to TFS using a third set of credentials, as the my user (second set credentials) didn't have access yet. Now my user have access and I wish to use these credentials instead.
TFS automatically logs me in with the third set credentials every time I open VS using "Run as different user" - However, if I open VS normally without using "Run as different user" I get prompted for login to the TFS.

I have tried checking the Windows credentials and there is nothing there. And I can't log onto the server using the second set credentials as only the first set can access the server with Remote Desktop.

So how do I "clear" cached TFS credentials when using "Run as different user"?

Was it helpful?

Solution

Go to control panel > User Accounts > Manage Your Credentials > select your Team foundation Server and choose remove/edit - viola! Next time you go into Team Explorer you will be prompted for a new set of credentials.

Ref: http://blogs.msdn.com/b/visualstudioalm/archive/2012/08/29/clearing-the-credentials-for-connecting-to-a-team-foundation-server.aspx

OTHER TIPS

You can try clearing the cache manually here:
C:\Users[USERNAME]\AppData\Local\Microsoft\Team Foundation\5.0\Cache

You could also try using the /profile parameter and specifying the username's profile when you run it.

Runas /profile /user:[DOMAIN]\[administrator] "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe"

http://technet.microsoft.com/en-us/library/bb490994.aspx

For me it was not username/PASSWORD, but the cached username that was the issue. And that IS stored in VersionControl.config in the cache. Whacking just that file was enough to get TFS to stop trying to connect with the old email.

I ran into this issue as well, but clearing out the AppData settings didn't help.

I had created a console application to connect to TFS and it prompted me for credentials the first time I ran it. After that, the credentials were stored and would supersede any other credentials I provided. I finally figured out that VS had added a registry entry in:

HKEY_CURRENT_USER\Software\Microsoft\VSCommon\14.0\ClientServices\TokenStorage\VisualStudio\VssApp

Deleting the key worked, but I also discovered that one can accomplish the same programmatically:

var clientCredentails = new VssClientCredentialStorage();

// URI of the target TFS server
var tfsUri = new Uri("https://[username].visualstudio.com/DefaultCollection/");

// Find the cached credentials
var federatedCredentials = clientCredentails.RetrieveToken(tfsUri, VssCredentialsType.Federated);

// Remove the credentials from the cache
clientCredentails.RemoveToken(tfsUri, federatedCredentials);

I had a similar problem where I needed to log into a local TFS as another account than my Windows account (found in Active Directory which TFS is connected to) - but I could not see any credentials in the manager.

The solution was to disconnect inside VS (Menu Team->Disconnect). Then create a Windows account in the Credentials Manager with the same user as my Windows user - but with a password that is incorrect. The URL/server was just "tfs" (no port etc).

When I start VS it fails the login to TFS and asks for correct password and username too. Then I can change this to another user and VS default to this the next time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top