Running SQL Server natively on macOS using Azure SQL Edge
- data, mac
- 2023-06-30
- 2 minutes to read
- sql server
- sql edge
- docker
Table of Contents
A long time ago in a galaxy far, far away…
This post is over 12 months old, that's a long time in tech! Please be mindful of that when reading this post, young Padawan, as it could be outdated. I try to keep things up to date as much as possible. If you think something needs updating, please let me know in the comments.
Introduction
I use my Mac as my day-to-day machine and I have always had to find creative ways to run SQL Server and Power BI since they don’t natively run on macOS. The Mx chips that now run Apple’s latest Macs are based on ARM architecture which makes it even more challenging to run SQL Server. This shift means that running SQL Server in VMs is pretty much impossible at the moment.
Azure SQL Edge is an optimized relational database engine geared for IoT and IoT Edge deployments, is built on the latest versions of the SQL Server Database Engine, and provides the same Transact-SQL (T-SQL) programming surface area. This means that you can run SQL Server on macOS using Docker and it’s really easy to set up.
2024 update
In September 2023 Microsoft ended support of Azure SQL Edge on ARM64. You can still run SQL on your Mac using Docker, read this post to find out how.
Pre-requisites
Before we can complete the steps below, we need to install Docker which you can get from Docker docs.
Get container image
Once docker is installed, we need to get the container image for Azure SQL Edge. We can do this by running the following command with docker running:
docker pull mcr.microsoft.com/azure-sql-edge
Create an instance
Once downloaded, we can create an instance of the container by running the following command:
docker run --name sqledge -e 'ACCEPT_EULA=1' -e 'MSSQL_SA_PASSWORD=MyReallyStr0ngPassw0rd!' -d mcr.microsoft.com/azure-sql-edge -p 1433:1433
Note: Make sure you set your own password!
Connect from Azure Data Studio
With the container running, you can now connect to it from Azure Data Studio. You can do this by creating a new connection and entering the following details:
- Server: localhost
- Authentication type: SQL Login
- User name: sa
- Password: (the password you set above)
Conclusion
For fundamental SQL Server tasks, Azure SQL Edge is a simple way to run SQL Server on macOS and it’s really simple to set up.