Connecting to SQL Server with Windows Authentication to a different domain

How do you solve the problem of connecting from say your office computer in the office domain to your production environment when there is no trust between the domains?
This scenario is quite common in larger companies. The reason is usually to add an extra layer of security between the two networks by keeping them separated.

So if you still want to connect, how do you go about doing this?

You could always bring out the trusty SQL Server authentication with local sql accounts on the production network.The problem with this is that you have to create local user accounts on all servers you want to connect to.

Or you could start your SQL Server Management Studio with your production network account  and connect with Windows Authentication mode. This is where the Windows command runas comes in handy!

RUNAS.EXE

First locate the path to your SQL Server Management Studio by right clicking on your icon. You’ll probably get a path that looks like this:

C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe

Open up a command prompt and type in

runas /netonly /user:productiondomain\productionusername
"C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe"

You will now start SSMS under the production user account and can now connect to your production servers through the Windows Authentication mode, as if you would have done when connected with RDP (Remote Desktop) to your production server.

Tip

You can create a shortcut that will start SSMS with the runas command to speed up things!

 

This entry was posted in DBA, SQL Server, Tips. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *