Azure Data Studio - Connecting To Azure SQL Database

In this article, we’ll learn to connect and access the Azure SQL Database through the Azure Data Studio. In following articles, we'll  learn to create tables, query data, view the data and then delete the table. First of all, we need to create a Azure SQL Database and a SQL Server. You can learn it from the previous articles, How To Create, Query And Delete Database In Azure SQL and Create Single Serverless Database. You can also get introduced to Azure Data Studio from the previous article, Azure Data Studio and learn how to install it. 

Azure Data Studio

Azure Data Studio is basically a database tool that is cross-platform routinely used by data engineers and professionals for both on-premises and cloud services throughout the operating system spectrum from Windows to macOS and Linux. There are numerous modern editor offerings with the Azure Data Studio from Code Snippets, IntelliSense, Integrated Terminal, Source Control Integration, and more. A great experience with charting of query results, customizable dashboards are supported built-in. 

Now, let us get into learning how to connect to Azure SQL Database from the Azure Data Studio with the step-by-step tutorial.

Connecting to Azure SQL Database 

Step 1 

Open your Azure Data Studio. You’ll be welcome to this home page.

Step 2

Click on New Connection.

Step 3 

You’ll be prompted with a form for Connection Details. Here you’ll fill in the Server Details, Authentication Types and more details. These values are from the Azure SQL Database you’ve created earlier following the Create Single Serverless Database article.

Step 4 

I created the ojash.database.windows.net Server.

Here, the Authentication type is SQL Login. Next, type in the User name and Password you had set during creating the Azure SQL Database.

Then, click on Connect.

Step 5 

Now, you need to connect the Azure Account.

Click on the Add an Account tab and connect accessing your Azure. Once done you’ll be confirmed as follows.

Step 6 

Next, we need to setup the Firewall Rule. Choose your Azure Account and the Default Directory.

Next, add in the Client IP and Click on OK.

Note: If the Client IP failure dialog box pops up, go to Azure and Set the Client IP and Save the setup.

Step 7 

Now, the Azure SQL Database has been Connected to Azure Data Studio.

You can see the ojashdatabase and master with its status along with the Type, Azure SQL DB.

Step 8 

You can now perform any query into this database from Azure Data Studio. We’ll learn more about it in the next article.

Conclusion 

In this article, we learned a step-by-step tutorial to Connect Azure Data Studio to Azure SQL Database. With this connection, we can now perform any query. We’ll learn more about  creating tables, adding data and then deleting them in the next article.