MSSQL Server Windows Authentication – Connect to another domain

Sometimes you may find that you need to connect MSSQL Server Windows Authentication to another domain for your works. This might be a problem when you are not using SQL Authentication to login to the server and you have to use Windows Authentication.

The most popular and easiest solution for the problem while connecting MSSQL Server Windows Authentication in another domain is to Remote to a machine in the same domain and connect to the database using SQL Server Management Studio (SSMS). But this can be an issue in the corporate environment since many corporations have policies that restrict installing certain applications. Another problem would be if they have limited the concurrent login to that machine and you are not the only one to access that machine remotely.

So how we can solve this problem by not getting SQL Authentication and adding your machine to the required domain. There are 2 ways we can use to remedy this problem. Furthermore, this method is not only limited to SQL Server Management Studio, but we can also use it for many windows applications.

Connect using runas /netonly

Here we use windows built-in command run-as to run an application with windows authentication using the command line.

runas /netonly /user:domain\username "C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\ssms.exe"

Run the above command in the Command-line interface.

MSSQL Server Windows Authentication

Then you are prompted password for the given remote user and once given the password it will show that it will attempt to access the application as that user.

After the application opens, you can use the SSMS like you are using local user.

MSSQL Server Windows Authentication

If you will connect the same remote many times, it is difficult to type this command every time in CMD again and again.

Don’t worry, we have a solution for that.

You can create a shortcut to execute that command and open the application as expected.

Please follow the guidelines below,

Right-click on the desktop and choose Shortcut.

Create shortcut

Then enter the same command which we have given in the CMD.

create shortcut

Provide an easy name to remember

create shortcut - Shortcut name

Now your shortcut is ready, just double click to open it.

MSSQL Server Windows Authentication

Then enter your domain account password and hit Enter, Then Microsoft SQL Server Management Studio will open.

MSSQL Server Windows Authentication

Provide your server name and select Authentication as Windows Authentication and press connect.

Finally, you will have access to your Database

Leave a Reply

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