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.
Best Answer
You are attempting to pass Windows credentials in plain text from the connection string of an application. This simply isn't how Windows authentication works, and largely defeats the purpose.
You also can't just create the same username with the same password in your own domain, and expect that to magically work. Domain name is still part of the validation - your machine either has to be part of the domain, or the domain your machine is in must be trusted by the school's domain.
The only workaround I know of is for SSMS (and it works for other apps too, like Plan Explorer and SentryOne), and that's the
runas /netonly
trick described in this answer. This fools Windows into launching SSMS as the login you specify, rather than your own (this isn't something you can set in the Connection properties dialog of SSMS, it's how you need to launch SSMS from the command line or a shortcut):This will prompt you for your password in the remote domain. It will look like it is using your local Windows credentials, but it is not.
This should work with any application, including Visual Studio.
So your options are:
runas /netonly
trick with SSMS or Visual Studio