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

5

1

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.

3Dave

Posted 2010-05-05T17:34:19.287

Reputation: 341

Answers

6

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"

Mpadala

Posted 2010-05-05T17:34:19.287

Reputation: 76

2I have this working without having to create a credential; that step seems redundant. Thanks nevertheless. – 3Dave – 2011-04-12T16:18:45.347

2I have tried this but in my case, the SSMS launches and displays my local account as Username under Windows Authentication. – Hassan Gulzar – 2012-06-21T10:16:02.887