This Azure article will discuss how to connect to SQL server from Azure Data Studio. Along with that, we will also discuss a few other topics.
Table of Contents
Azure Data Studio Connect To SQL Server
Before starting the actual topic, let’s discuss the prerequisites needed here.
Below are the prerequisites needed here.
- You must have an Azure subscription or account. If you don’t have an Azure account, you needn’t worry- you can create a free Azure account now.
- You must download and install Azure Data Studio on your PC.
- Install SQL Server Management Studio’s latest version on your machine.
Assuming you are ready with all the prerequisites needed here, let’s start with the steps needed to connect to the SQL server from Azure Data Studio.
- Launch Azure Data Studio on your PC.
- Click on the New dropdown –> Then click on the New Connection option, or click the Create a Connection button.
3. On the Connection window, provide the below details
- Connection type: Choose the Connection type as Microsoft SQL server.
- Select the Parameters radio button.
- Server: Provide the Server name.
- Authentication type: Choose the authentication type and the other details based on the authentication type.
Finally, click on the Connect button.
Note: To get the server name and authentication details, open the SQL server management studio, and on the Connect to server pop-up, you will get all the details.
Now, you can see that we can connect the Azure Data Studio to the SQL server successfully without any issues.
How to connect Azure Data Studio to Azure SQL
Similarly, we can connect Azure Data Studio to Azure SQL using the below steps. Check out How to create an Azure SQL database if you have not yet created your Azure SQL database.
- Follow steps 1 and 2 from the above section.
- On the Connection window, provide the below details.
- Connection type: Choose the connection type as SQL server.
- Choose the Parameters option.
- Server: Specify the server name of your Azure SQL. You will get the server name by navigating to the Azure SQL database in the Azure POrtal. Refer to the below note.
- Authentication type: Choose SQL Login as the authentication type.
- Username and Password: Specify the Username and password you specified during the Azure SQL database creation in the Azure Portal.
- Finally, click on the Connect button.
Note: Navigate to the Azure SQL database in the Azure Portal and click on the Copy to Clipboard button next to the server name to copy the server name.
You might get the below connection error after clicking the Connect button.
“Reason: An instance-specific error occurred while establishing a connection to SQL Server. Connection was denied since Deny Public Network Access is set to Yes (https://docs.microsoft.com/azure/azure-sql/database/connectivity-settings#deny-public-network-access). To connect to this server, use the Private Endpoint from inside your virtual network (https://docs.microsoft.com/azure/sql-database/sql-database-private-endpoint-overview#how-to-set-up-private-link-for-azure-sql-database).”
You can see it here
To fix this error, you need to follow the below quick steps.
Public access to your Azure SQL database is disabled by default. To enable it, follow these steps.
- Navigate to the Azure SQL database in the Azure Portal and click on the server name.
2. Click on the Networking link from the left navigation on the SQL Server page.
3. Select the Selected Networks option for Public network access –> then click the Save button to save the changes.
4. Now, navigate to the Azure Data Studio and click the OK button on the error pop-up. Finally, click on the Connection button; this time, you won’t get any error and will move to the next screen.
Click the Add an Account dropdown and then the Add an Account option.
5. Login with your Azure credentials and click the OK button on the next pop-up.
6. Now, we can connect the Azure Data Studio with Azure SQL DB successfully.
You may also like following the articles below
- Azure SQL Database Vs. SQL Server
- How to backup Azure SQL database
- How To Change User Id And Password For Azure SQL Server Database
- How To Connect To Azure SQL Database
This article discussed how to connect Azure Data Studio to the SQL server and Azure SQL database. Thanks for reading this article. I hope it helps !!!
I am Rajkishore, and I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machine, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.