How To Use Visual Studio For Azure SQL Database

Introduction

This article demonstrates using Visual Studio step by step for Azure SQL Database operations.

Prerequisites

Recommendation

Please click here to go through my previous article about “Creating an Azure SQL Database and connecting through SQL Server Management Studio.”

Azure has too many functionalities nowadays, and day by day, the Microsoft team is adding more and more features into Azure. Here, in this article, we are going to use Visual Studio 2017 for Azure Database operations.

First of all, login to the Azure portal. Click here to go to Azure login page.

Azure SQL Database

After signing into the Azure portal, click on "SQL databases" from the left panel of the website, as shown in the below image.

Azure SQL Database

We will get the created database. Click on the created database “employee”.

Azure SQL Database

Now, click on “Tools” as shown in the below image.

Azure SQL Database

Click on the “Open in Visual Studio” menu.

Azure SQL Database

Click on the “Configure Firewall” link for providing the access for a specific computer.

Azure SQL Database

Now, enter the rule name as per your convenience and enter the IP address of the computer from where you are going to use the Visual Studio to connect to Azure SQL Database.

Here, we can also give permission for continuous series of IP addresses by providing the Start IP address and End IP address, or we can allow only for one computer by entering the same IP address in both fields.

We can also see the current system’s IP address from the "Firewall settings" screen. After entering the IP address details, click on the "Save" button as shown in the below image.

Azure SQL Database

We will get success message. Click OK.

Azure SQL Database

Now, click on the “Open in Visual Studio” button.

Azure SQL Database

Click on the “Open…” button as below.

Azure SQL Database

Now, enter the password for authentication.

Azure SQL Database

We can see that Azure SQL Database is connected to the SQL Server Object Explore.

Azure SQL Database

Right click on the “employee” table and click on the “New Query”, as shown in the below image.

Azure SQL Database

Now, write a SQL query for creating a table “Department” and execute it as below.

Azure SQL Database

In this easy way, we can perform all database operations through Visual Studio.

Summary

In this article, we have learned how to use Visual Studio to perform Azure SQL database operations on an existing database.