Azure Data Studio, a cross-platform database development tool originally branded as SQL Operations Studio and provide seamless database management experience, regardless of whether users are connecting to on-premise or Azure-based data platforms.
Azure Data Studio is a cross-platform database tool for data professionals using the Microsoft family of on-premises and cloud data platforms on Windows, MacOS, and Linux.–Microsoft
For many standards functions, Azure Data Studio offers a much richer experience that Microsoft’s flagship database management tool, SQL Server Management Studio (SSMS).
Azure data studio has better intelligence as compare to microsoft sql server management studio and more extensive with support for keywords and useful TSQL snippets. For example, with a few key presses you can locate and open the snippet for a CREATE PROCEDURE statement.
once you press tab then complete stored procedure creation base script automatically come and make changes as per requirement.
Download sql server docker image & Run Container
First you have to pull docker image for sql server from docker container registry, here i have selected sql server linux image.
Command: docker pull microsoft/mssql-server-linux
check docker image status by issue docker image command which list all downloaded images from docker registry.
Command: docker images
In Docker we can “install” an image by running it. And that creates the actual Docker Container, which is finally the executable that you are executing. Let’s run our Docker Image with the docker run command:
Command: docker run -d –name homer -e ‘ACCEPT_EULA=Y’ -e ‘SA_PASSWORD=<YourPassword>’ -p 1433:1433 <imageName>
- -e ‘ACCEPT_EULA=Y’ With the -e option you set an environment variable, on which SQL Server is dependent on. In our case we have to accept the EULA to be able to use SQL Server.
- -e ‘SA_PASSWORD=Password@123‘ With the SA_PASSWORD environment variable we set the password for the SA login.
- -p 1433:1433 With the -p option we bind a port on our host machine (in my case on the Mac) to a port in the Container. The port on the left side of the colon is the port on the host machine, and the port on the right side of the colon is the port in the Container. In my case I bind the default SQL Server port of 1433 within the Container to the port 1433 on my Mac.
- –name : With the –name option we assign a custom name to our Docker Container.
- -d :And with the -d option we specify the Docker Image that we have pulled previously, and that you want to run the Docker Container detached from the Terminal. This just means that you can close your Terminal, and your Docker Container is still running in the background.
After you have executed that Docker command, your Docker Container is up and running and ready to use.
Connect Azure Data Studio With Container.
we can connect azure data studio with running container here directly to localhost, because in the last step we have exposed the port 1433 of the Docker Container to our host machine.
Once connection established successfully,you can see server details on home pane where you can verify that container id is coming as computer name on azure data studio which means you have successfully connected to running sql server container and now you can execute sql server queries.
Execute Sql Quries
after successfully connection with sqlserver container,right click on database and choose new query option. A query window will option and now you can execute sql queries and run it .
Run sqlserver on mac is always very tedious task and tools which is available for mac is not easy to use and not much responsive.But docker made developer life easy to run sqlserver on mac os with better user experience.
it’s now real. You can now run natively SQL Server on the Mac, and with the help of Azure Data Studio you can even access SQL Server with a native MacOS.