13

Is there any way I can connect to a remote SQL server with Windows Authentication over VPN?

I can connect to the VPN server in Windows 7 using Domain Credentials like \DOMAIN\user but I want to be able to connect to the SQL server with the Domain Credentials because I don't have the sa account .

Cœur
  • 37,241
  • 25
  • 195
  • 267
pufos
  • 2,890
  • 8
  • 34
  • 38

1 Answers1

46

Try creating a shortcut with:

runas /noprofile /netonly /user:domain\username ssms.exe

You may have to hard-code the path to ssms.exe. On modern versions, that's:

"C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe"

In a few locations it will look in SSMS like you are using your local credentials, but you should be able to verify on the remote server that your credentials are being passed, e.g.

SELECT SUSER_SNAME();

This of course depends on your requests being correctly routed to the destination SQL Server.

Aaron Bertrand
  • 272,866
  • 37
  • 466
  • 490
  • `runas` is a Windows built-in that allows you to run an executable in the guise of another user. You can read more here http://technet.microsoft.com/en-us/library/bb490994.aspx and here http://en.wikipedia.org/wiki/Runas – Aaron Bertrand Mar 12 '12 at 18:52
  • 1
    Are you a wizard? Seriously though, that did the trick. Awesome little bit of functionality that I had no idea existed. Thanks! – Michael Apr 16 '15 at 16:34
  • Thanks, I was missing the /noprofile /netonly otherwise you will get an error "The security database on the server does not have a computer account for this workstation trust relationship." – Cross Mar 12 '18 at 22:30
  • Worked perfectly! I had to specify the file location, for most people this will be: "C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe" – Design.Garden Feb 27 '22 at 19:46