Windows 7 Credential manager and accessing SQL Server from outside of the domain

credentialsdomainrunassql serverwindows 7

My SQL Server is set to use Windows authentication. If I am connected to the domain directly from my Windows 7 Ultimate x64 machine, SQL Management Studio (SSMS) will let me authenticate with Windows authentication. However, if I am connected via the VPN (from a different machine that is not joined to the domain), it won't.

If I start SSMS with the following command line:

C:\Windows\system32>runas /netonly /user:domainname\username 
"C:\Program Files (x86)\Microsoft SQL...\ssms.exe"

then connecting to the SQL Server (which is in the domain) with Windows Authentication works fine.

I'd like to save these credentials so that I don't have to launch SSMS from the command line, or modify the shortcut. I know I can use the SysInternals ShellRunAs extension to do this, but I again have to enter my domain username and password each time, and shift+right-click to see that menu option.

The Windows Credential Manager seems designed to solve this problem, and works for network shares. However, it doesn't seem to work for SSMS. Any suggestions?

I've tried using the /savecred option with runas to create the necessary credentials, but that appears to be incompatible with the /netonly option. Running the above command line with the addition of /savecred just displays the runas help screen.

Best Answer

Use Windows Credential Manager.

Create a new Windows credential with the following details:

  • dbservername.domain.com:1433
  • domain\UserId
  • Password

Also create a shortcut for SSMS with the following in TARGET:

C:\Windows\System32\runas.exe /user:domain\userid /netonly "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\binn\VSShell\Common7\IDE\Ssms.exe -nosplash"
Related Question