Why do this?
Recently, I’ve been using Ubuntu as a host operating system and running virtual machines for my various development and sandbox server environments. This has led me to not particular want to register all of my client VM’s with our work domain and just pass my credentials when needed. For most applications this works fine; however, with SQL Server Management Studio to login to databases with Windows Authentication it appears you can only use the currently logged in user rather than prompting for credentials.
Can you do this for other applications?
Absolutely, this is basic functionality in the OS; however, since most applications simply prompt for AD credentials instead of binding you to the current logged in local user account, it’s less common than you would think.
Here is the command line:
runas /netonly /user:[domain]\[username] "[ssms_exe_path]"
runas /netonly /user:workdomain\nbarger "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe"
P.S. – you can also add this to your Target in the property window of any SSMS icon for convenience.