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.
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.
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.
Then enter the same command which we have given in the CMD.
Provide an easy name to remember
Now your shortcut is ready, just double click to open it.
Then enter your domain account password and hit Enter, Then Microsoft SQL Server Management Studio will open.
Provide your server name and select Authentication as Windows Authentication and press connect.
Finally, you will have access to your Database