You might think that this will be another post about virtualisation using Parallels Desktop or similar software. Well, it will not. However, unfortunately, it will also not completely deliver what it promises. Unfortunately, there is no version of SQL Server available to install directly on the macOS.
Azure SQL Edge is a relational database engine, built on the latest versions of the SQL Server Database Engine. Since Azure SQL Edge is built on the same engine, it provides the same T-SQL programming surface area. SQL Edge is a fully containerised solution which runs on multiple docker engines, including the arm64 Architecture, which is exactly what we need.
So, how does that all help us? Well, we will use docker to run this Azure SQL Edge Engine in a container.
Docker is a product that enables us to use the software delivered in packages, also in so-called containers, meaning that Microsoft has packaged the Azure SQL Edge database engine in a container which we can then run on our Mac. So, the first step is then, naturally, to install Docker. It’s free.
After the installation, you would naturally launch the Docker. You will be probably prompted to enter your password so that the installation can finish. After that, you will see the docker icon in the Status bar and when you open the Dashboard you will see something like this:
You can go ahead and minimise this window as we will not yet be needing it.
Install Azure SQL Edge
Now go ahead and open the Terminal. The first thing we will do is pull the Azure SQL Edge image on our local machine:
docker pull mcr.microsoft.com/azure-sql-edge:latest
The image will be pulled to your machine, so wait patiently until it is downloaded:
After that, we need to use the following command to launch an instance of the Docker image previously downloaded – just be sure to replace the yourStrongPassword placeholder with a desired strong password of your choice.
docker run --cap-add SYS_PTRACE -e 'ACCEPT_EULA=1' -e 'MSSQL_SA_PASSWORD=yourStrongPassword' -p 1433:1433 --name azuresqledge -d mcr.microsoft.com/azure-sql-edge
If the command runs with no errors, everything should be fine. You can check the status of the container using the command:
You should see something like this:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 7d0afd3d51df mcr.microsoft.com/azure-sql-edge:latest "/opt/mssql/bin/perm…" 6 seconds ago Up 5 seconds 1401/tcp, 0.0.0.0:1433->1433/tcp azuresqledge
However, you might not see anything but a status line, you might want to switch to the Docker Desktop to see what’s going on. For example, if you do not set a strong enough password, the container will be stopped with a message:
ERROR: Unable to set system administrator password: Password validation failed. The password does not meet SQL Server password policy requirements because it is too short. The password must be at least 8 characters...
In this case, it might be the simplest to delete the container using the Docker Desktop GUI and run it again, respecting the Password Requirements this time.
Connect to Azure SQL Edge
Azure Data Studio
After downloading the zip file, simply drag the .app File to your Applications folder and run it. After starting, you can connect to your instance like this:
An alternative to Azure Data Studio: DBeaver
Optionally, you can use DBeaver as well to connect to and work with your Azure SQL Edge installation. The UI might be too Windows-like for you, but I find it to be a bit more powerful tool than Azure Data Studio, as you can perform many operations using the GUI.
When setting up a Connection, simply use “Microsoft SQL Server” as the Server type.
So, there we have it. It is possible to play with a product that is very similar to SQL Server on a Mac with Apple Silicon, which is good news for all DB Admins and Developers who prefer to use Microsoft technologies.