Learn About Azure SQL Server Using VS Code

Microsoft Azure provides a cloud-based SQL Server. It can quickly scale the database up or down depending on your business needs.

In this blog, we will understand how to create a SQL Server in Microsoft Azure portal and use it with Visual Studio code.

Let’s get started.

Create Azure SQL Server:

Log in to your Azure portal, then click on create a resource in the left side menu.

Learn About Azure SQL Server Using VS Code 

You want to enter a valid database name, subscription, and resource group.  I am selecting a blank database. We must configure server name & login credentials so that we can access it over any of the tools and sources.

Learn About Azure SQL Server Using VS Code 

Next configure the price tier.  Recently, Microsoft  provided some advanced options for computation. 

Learn About Azure SQL Server Using VS Code 

Once complete, then you will be ready to use the Azure SQL Server

Learn About Azure SQL Server Using VS Code 

Before connecting to the server, we must Set the Server Firewall.

Learn About Azure SQL Server Using VS Code 

Allow access to Azure services -- select ON

Now it will show the current IP Address. You can grant access permission to an IP address.

Use with Visual Studio Code

You will download VS Code from here. Open VS code Editor. Then go to Extensions tab, find the SQL and install the one with SQL Server (mssql)

Learn About Azure SQL Server Using VS Code 

After that click F1 to connect the Azure SQL Server. It will ask for server name, database & login. Finally, enter your profile name to connect.

Learn About Azure SQL Server Using VS Code 

I received this connection error

Learn About Azure SQL Server Using VS Code 

I can reset the Azure SQL Server Firewall. This time increase the range of IP addresses.

Learn About Azure SQL Server Using VS Code 

Now, my Azure SQL Server connection has been established.

Learn About Azure SQL Server Using VS Code 

Then just run the sample query for testing,
 
Learn About Azure SQL Server Using VS Code 

Also, we can monitor our resource utilization.

Learn About Azure SQL Server Using VS Code