6

I have to connect remotely to MSSQL database from my local machine, using remote server windows Authentication.

7
  • Are you on the same network and windows domain? Mar 9, 2017 at 8:24
  • What software are you trying to connect to SQL with? Mar 9, 2017 at 8:41
  • Has someone created a login for you on the server? Whoever did that should be able to provide you with the details. Mar 9, 2017 at 8:42
  • I am in same network but need to log in with different domain credentials to connect SQL server. Mar 9, 2017 at 9:38
  • we don't want to use any software such as SSMS, we are aware about the SSMS approach. we are interested to do it using cmd or powershell commands. Mar 9, 2017 at 9:41

2 Answers 2

10

Assuming you are in a different domain, you can launch SSMS using the remote Windows commercials. Open a command prompt in the folder where ssms.exe lives, and run:

runas /netonly /user:remotedomain\remoteuser ssms.exe

You will be prompted for your password. SSMS will be using remote Windows credentials even though several UI elements will look like you're using the local ones.

This technique should work for launching other executables, like sqlcmd or powershell, but I haven't tested those. I know it works for SentryOne and Plan Explorer.

You can also use Credential Manager, which I wrote about (in addition to more details about runas) here:

3
  • @Anton I wonder if you could try something like this - use powershell to call powershell. Mar 9, 2017 at 12:58
  • I can confirm that the /netonly trick works for PowerGUI and PowerShell, but I only used it through the SMO objects. Mar 9, 2017 at 13:14
  • 1
    Correction: runas /netonly /user:remotedomain\remoteuser powershell.exe worked. Mar 9, 2017 at 16:18
0

There are few different methods.

Assuming: you are logged into windows, on the same network, and the same domain:

You can connect using the server name or you can use the ip address of the server.

From sql server management studio: click connect > data engine. Enter the server name or ipaddress. Make sure windows authentication is selected and click login.

Provided that you have been granted login privileges on the sql server it should allow you to connect.

This microsoft guide has instructions including screen shots

There are some variations on the theme above such as if the data is a named instance rather than using the default name. But generally if you have been setup to use windows authentication you just need to know the server.

If you are using other products and connecting via ODBC you may need to configure a connection first.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.