Connect to TFS from VS with multiple accounts

Assuming that you are using Windows Integration Authentication to access TFS, any instances of Visual Studio run during a Windows session will always use the current user to access TFS... Fortunately, there is a simple trick to connect on TFS with multiple accounts without starting new Windows sessions with other users.

Click to Read More

If like me you are a TFS administrator, you could indeed need to switch quite often from one user account to another. e.g.: to work in TFS with another profile (Contributor or Builder) and validate various configuration settings (security, etc...).

In such a case, the easiest is to right-click on the Visual Studio Shortcut (e.g.: in the Start Menu >  All Programs > etc...) and select "Run As...". Then enter the windows account to be used to connect to TFS.

Notice: Each time you will do that for the first time with a new account, Visual Studio could start much slower than usually as it has to create a new profile...

Notice: The account used to "Run As..." Visual Studio won't become the new default account. I.e.: it won't be reused the next time you run Visual Studio!

You can also edit the properties of the shortcut to Visual Studio (or create a copy of that shortcut). Then, click on the "Advanced" button in the "Shortcut" tab and tick the option box "Run with different credentials". Doing that, you will always be prompted to enter an account when running Visual Studio.

To permanently change the default account used by Visual Studio to connect on TFS, I read that we have to change the credentials used for the that TFS server in the "Credentials Manager" (Control Panel > User Accounts > Credential Manager). Unfortunately  I may not do that here at the office :/

To check with which user you are connected to TFS, check-out any file and have a look on the "User" column in the "Source Control Explorer".

Notice: You may run two instances of Visual Studio with distinct accounts simultaneously. There won't be any "conflict".

One thought on “Connect to TFS from VS with multiple accounts

Leave a Reply

Your email address will not be published. Required fields are marked *