Installation & working SQL Developer edition of Azure on Windows using Docker & Azure Data Studio
Introduction :
This article helps you to have a quick start with docker, usage of Azure Data storage with SQL developer edition which is part of the Ubuntu container.
Azure Data Studio :
This is a free cross-platform IDE from Microsoft that helps to work with your databases & data warehouses with the full support of code snippets, external extensions, and Source control integration.
Docker:
It is container-based virtualization support for the operating systems. This implies that the very app that you want to deploy in the production or want to work in the development and its dependencies would be embedded as a single isolated process and is away from interfering with the business of operating systems and apps in the other containers, which can also likely be the same app of a different version.
SQL Developer Edition :
The most popular edition of SQL server helps us to create/do most of the database-specific operations. The reason I used a Ubuntu SQL image on azure is it's free or at a minimal cost. The details of the registry are specified in the Installations section.
Pre-Requisites:
The following are the installations that have to be available, if not please use the links to download it
Configuring/creating the resource in the Azure portal
4. Please note the docker image pull command of the created resource, this can be accessed by clicking the Repositories on the side blade of the provisioned resource
The docker image
Navigate to the command line or your docker terminal, follow the below commands in the order
az login
az acr login --name <registryname>
Note: The registry name would be available from the AccessKeys blade of the created image in Azure
2. Pull the docker image to your local machine
docker pull <imagedetails>
3. use the following command to start the docker container (Container is term coined for instance of the image). Also note that docker uses a term called tag - used to identify the specific instance of the image
docker run -e 'INIT_PASSWORD=HelloPassword_01' -p 1433:1433 --name SU2 -h SU2 -d <servername>.azurecr.io/ntegralinc<ID>/ubuntu18-04-sql-developer:latest
Inputs
Recommended by LinkedIn
Output
It prints the unique Id of the container/instance if no errors.You can check the running containers using the below command
docker ps -a
Note: Though the image is free, you might be charged for Azure Container registries, so use the docker stop and start commands to be safe on pockets
docker stop <ContainerID>/<ContainerName>
From the above example, you can use the stop command
docker start <ContainerID>/<ContainerName>
At any point, if the docker list command says it is exited or not running, you can use logs to check on the issue
docker logs <Containerid>/<Containername>
Once your docker image is started, we can verify it using sqlcmd commands/SSMS (SQL Server Management Studio) or Azure Data Studio, in this example am using Azure Data Studio
Azure Data Studio
The following steps would be necessary to initiate a connection
Server - LocalHost
Authentication Type - SQL login
UserName - sa
Password - HelloPassword_10
Note : The password would be the same as the password used during docker Container provisioning (docker run command)
Once connected successfully, you should be able to see the default databases listed.
To work with Azure Data studio, it is recommended to use the plugin
Once the extension is installed, you can use, File-->new query option from the toolbar to deal with all the SQL-related operations.
Note: If you see any errors, use the docker logs or ps command to check the state of the container (started/exited). All the changes made would be affected by the container, not the actual image.
docker logs <containerID>
docker ps -a
Here completes the setup of the tools required to start your database project in Azure with minimal cost.