Thursday, January 20, 2011

Running SQL Server Management Studio over VPN

If you want to run SQL Server Management Studio over VPN using Windows Authentication you have to somehow supply your credentials from the target domain.

This is how:
use the "runas" command from the command prompt and be sure the include the /netonly switch and specify the user account from your target domain. If you do not include the /netonly switch you will probably get a "no logon servers" type of message. When you connect to a sql server with Windows Authentication it will look like you are using your local account, however, your target domain account credentials will be passed to the sql server!

Here's and example of the command. You can create a shortcut for ease of use. NOTE: you will always be prompted for your password.

RUNAS /user:targetDomain\username /netonly "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe"

On Vista you will need to be sure that you're running as Administrator if you have UAC configured.

If you make a shortcut right click and choose Run as adminstrator when you want to run it.

Thanks to LucidObscurity writing in the thread Windows Authenticaton - Different Domain.