Connecting to SQL Server from a Mac

code mac sql
June 22, 2021 / Robert Zehnder

I needed to be able to connect to SQL Server using Windows authentication on my Mac. Here is how I got the connection working with Parallel's Desktop and SSMS using Windows runas command.


I am working a project migrating a ColdFusion application from MariaDB to SQL Server. That by itself is not an issue, ColdFusion can easily talk to SQL Server. My issue is I use a Mac and I need to authenticate to SQL Server using Active Directory to be able to view the data. Normally I use DBeaver since it will connect to pretty much anything, but I could not get Windows authentication working with the stock SQL Server driver. It may be possible using the jTDS driver, but I have not gotten that far yet.

I run Windows 10 in Parallel's Desktop for those times when nothing but Windows will do. I downloaded and installed SQL Server Management Studio, but I hit another issue; the virtual machine does not connect to active directory. When I tried connecting to SQL Server using SSMS it did not recognize the machine so it still did not authenticate.

The fix is using the runas command in Windows to manually set the domain and user to run SSMS as. The user displayed in SSMS will still show as the local user, but it will connect using the supplied credentials.

runas /netonly /user:DOMAIN\user "C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\ssms.exe"

I created a shortcut on the desktop with that command, problem sovled.

Now I just need to get the DBeaver connector working.

Cover image by Matthew Mauel on Unsplash

About Robert Zehnder
Robert is a Senior Lead ColdFusion Engineer. In his spare time he enjoys hanging out with his family, his dog, and working on cool stuff.