SQL Management Studio – Supply specific windows credentials

I had an issue recently where I needed to connect to a SQL Server 2008 database using SQL Server Management Studio with a specific set of credentials via windows authentication.

You will no doubt have noticed that by default when a user selects windows authentication the username and password fields are greyed out and the username is populated with the user  account currently logged in to Windows.  This meant that I didn’t have access to the database that I required and I was unable to proceed unless I had a valid SQL Authentication account.

Having spent ten mins looking into this it turns out it is entirely possible to run SQL Management Studio from the command prompt and supply the username and password it should use.  Below is the command to do this:

>runas /user:DOMAIN\USERNAME “C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe”

Assuming the path is correct you will be prompted for the password associated with the account and if supplied correctly SQL Management Studio will open with the supplied details populated for windows authentication.

Very handy!

This entry was posted in Security, SQL, SQL Server Management Studio, Windows and tagged , , , . Bookmark the permalink.

8 Responses to SQL Management Studio – Supply specific windows credentials

  1. James says:

    Thanks alot man. saved my ass

  2. Mike says:

    Well, one workaround is to log out, log in as the necessary user, then go from there. This is a pain, slow, and just plain unnecessary as you pointed out.

    You don’t *have* to use the command prompt, either. Just right-click, Run as…

    • MJ says:

      Hi Mike, thanks for the response.

      The suggestions you have made may be valid in some situations but the situation I found myself in when I wrote this post was connecting to a client’s network via VPN and it was only possible to login to the machine using credentials that had already been authorised for VPN access (and that I had the token for), so logging in using different credentials was unfortunately not an option.

      This was also on Windows Server 2008 were the run-as context menu option is not available thus I had to use the command window options mentioned above.


  3. MJ says:

    You’re absolutely right Mike, that would be handy in a dev environment. :)

  4. Hello,
    I’m using the /netonly as well with it, very handy when connecting to multiple sessions in different domains.

  5. Unless you have received some nice disposable income just burning
    an entire in your wallet ready to be spent, an excellent
    massage might price an excessive amount of to do it on a weekly basis.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s