In this Azure article, we 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 Azure Account. If you don’t have an Azure Account, nothing to worry you can create a free Azure account now.
- You must download and install Azure Data Studio on your PC.
- Make sure to install SQL server management Studio 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 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, you can click on 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 able to see, we are able to 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 step-1 and Step-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 that you have specified during the creation of Azure SQL database 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.
After you click on the Connect button, you might get the below connection error.
“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.
By default public access to your Azure SQL database is disabled. You need to enable it using the below 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 on the Save button to save the changes.
4. Now, navigate to the Azure Data Studio, and click on the Ok button on the error pop-up. Finally, click on the Connection button, and this time you won’t get any error and will move to the next screen.
Click on the Add an Account dropdown and then click on the Add an account option.
5. Login with your Azure credentials and click on the Ok button on the next pop-up.
6. Now, you can able to see we are able to connect the Azure Data Studio with Azure SQL DB successfully.
You may also like following the below articles
- 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
- Cannot Open Server Requested By The Login Azure SQL
- How To Deploy SQL Database To Azure
Well, in this article, we discussed how to connect Azure Data Studio to SQL server and Azure SQL database. Thanks for reading this article, Hope it helps !!!