How To: Windows 8 “Windows Authentication” with Sql Server

The company I work for has an application that connects to a Microsoft Sql Server via Windows Authentication. In Windows 8 the only way to connect was to setup the user account as a “local” account. The downside to this is that you lose some functionality such as OneDrive support.

Because the Windows Live account doesn’t use windows authentication I would get this error message: “[Microsoft][ODBC SQL Server DRiver][SQL Server]Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.

Image

I have figured out a work around. I got this idea from a post by John Paul Cook on SqlBlog.com.

First you have to create a local account that works with your server. Setup the program so that it works correctly in this local account.

Now switch to your Windows Live account (a separate user) and modify the program’s shortcut. The target needs to be changed. C:\Windows\System32\runas.exe /user:domainName\localAccountName /savecred “pathToExecutable”

Image

Where localAccountName is the username of the local account you created earlier and pathToExecutable is the file path for the program that needs to use Windows Authentication.

The first time you launch the program it will ask for the password for the local account. The second time the credentials should be saved.

Problem solved 🙂

Advertisements