Before discussing the complete steps for this functionality, consider the prerequisites needed here.
- You must have an Azure subscription. You can create your free Azure Account.
- Ensure to install Visual Studio Code.
- You must create an Azure SQL Database.
Assuming you are ready with all these prerequisites. Follow the below steps
- Open Visual Studio Code from your local machine.
- Click on extensions from the left navigation –> search for mssql and click on the search result SQL Server (mssql) –> click on the Install button, as shown in the screenshot below.

3. Now, you can see a SQL Server icon on the left navigation. Click on the SQL server icon –> click on the + Add connection button, as shown in the screenshot below.

4. Enter your Azure SQL server name and then hit the enter key from your keyboard.

5. Enter your Azure SQL database name and press enter. You can also press enter directly without entering the name.

6. Choose the Authentication type based on the option you selected while creating the Azure SQL database. For me, it is SQL Login.

7. Enter the username that you entered during the Azure SQL database creation time.Press enter.

8. Now, enter the password you set during the creation time.Press enter.

9. Select Yes or No if you want to save the password or not based on your requirements. Press enter.

10. Enter a profile name and press enter.

11. You can see I connected to my Azure SQL Database successfully. Check out the screenshot below.

Note: There might be a chance after step 10, you will get the below error.
