Run as domain user

As mentioned in a previous post, when Visual Studio connects to external resources like Team Foundation Server, it uses your Windows credentials by default. I already explained how to use the Run as different user hidden option of the context menu. However this option doesn’t allow you to use domain accounts (at least that was the case when I wrote this post with Windows 7 and Visual Studio 2012). As a consultant, I sometimes need to use my own computer when visiting customers, which is of course not attached to their domain. There is definitely a solution to fix this issue. The following command indeed allows you to run Visual Studio as any user, even a domain user:

runas /netonly /user:MyDomain\MyUser “C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe”

The command prompt will then ask you to enter the password for the account you specified. That’s it! You are now running Visual Studio as a domain user.