HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlCritical

Connect to SQL Server with Windows Authentication in a different domain

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
connectsqlwithauthenticationdifferentwindowsserverdomain

Problem

I am trying to connect to a remote SQL Server on a VPN in a different domain. When I enter the Server name on the SQL Server and choose Additional Connection Parameters to add some extra stuff needed by my school:

Integrated Security=SSPI; User ID=DOMAIN\username; Password=Password


I get the following error:


Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.

Solution

There is another way, which I now use in preference to the runas /netonly method.

You can add the credentials to your profile in Windows using the Credential Manager found in the Windows control panel.

-
Open Credential Manager

-
Click "Add A Windows Credential"

-
Populate the "internet or network address" field with the name and port number of the SQL instance you wish to store credentials for.

Example: UniServer:1433 (1433 is the default port, you may need a different port, especially if you are connecting to a named instance)

-
Populate the "User Name" (don't forget to include the domain e.g. MYDOMAIN\MYUSER)

-
Populate the "Password"

-
Click OK

If you have the server name, port and login details correct, you should now be able to use Windows Authentication from most client tools, SSMS, Excel, whatever. They will all use the stored credentials.

Tip: Sometimes you need to use the FQN for the server when adding the credentials. e.g. UniServer.UniDomain.org:1433, it all depends on your network specifics.

Here is a quick demo of the method : http://youtu.be/WiVBPsqB9b4

It is a screen grab of me attempting (and failing) to connect to a SQL Server running in a VM from my desktop, then adding the required credentials and trying again - successfully.

Tip: use the "cmdkey /add" command to script creating and updating stored credentials.

Context

StackExchange Database Administrators Q#66014, answer score: 148

Revisions (0)

No revisions yet.