SQL Server on VM: Can I access my SQL server inside Azure VM through synapse notebook.?

Nitin Pandey 21 Reputation points
2023-01-09T06:01:38.643+00:00

I have my SQL server inside Azure VM, this is not publically exposed (i.e. I can't direclty access it thorugh SSMS on my desktop, I'll have to login into RDP machine and from there only I can access this DB thorugh SSMS (10.1.0.4)).
However, now we want to connect Synapse Notebook to that DB so that we can further process/cleanse the data before moving it ahead.
Is there any way via which i can connect my Synapse Notebook to SQL Server on VM.?

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
5,373 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bhargava-MSFT 31,261 Reputation points Microsoft Employee Moderator
    2023-01-09T19:47:53.393+00:00

    Hello @Nitin Pandey ,

    Welcome to the MS Q&A platform.

    Please correct me if my understanding is wrong. When you configure your SQL on Azure VM, you have selected the SQL connectivity as Private(within Vnet). Meaning, you have restricted the SQL connection over the internet. And You want to know how to connect Synapse to your SQL on VM.

    Public Connect to SQL Server over the internet.
    Private Connect to SQL Server in the same virtual network.

    Since you have configured the SQL server within the Vnet, please follow the below to connect synapse to your SQL on VM

    1) Your SQL VM and Synapse need to be in the same Vnet. If they are not in the same Vnet, you can create a Vnet peering connection to link these two Vnets.
    2) When you choose Private for the SQL connectivity type in the portal, Azure configures most of the settings identical to Public. The one difference is that there is no network security group rule to allow outside traffic on the SQL Server port (default 1433). So you will need to create an Azure firewall rule to allow inbound connections to the SQL Server instance.

    Once you configure this, then you can use %sql magic command in the notebook to connect to SQL server on the Azure VM.

    277477-image.png

    Reference document: https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/ways-to-connect-to-sql?view=azuresql

    I hope this helps. Please let me know if you have any further questions.


    • Please don't forget to click on 130616-image.png and upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.