Lesson Learned #140: Is it possible to connect from Azure SQL DB to Synapse using External Tables?
Published Oct 21 2020 03:50 PM 2,302 Views

Today, I got a very good question from a customer that they want to connect using Azure SQL DB to several tables of Azure Synapse using External Tables. Following I would like to share what was the lessons learned and how I was able to connect.

 

1) First of all, following I would like to share with you that script that I used to connect to Azure Synapse.

 

 

CREATE DATABASE scoped CREDENTIAL CredentialJM WITH IDENTITY  ='UserNameToConnect'
, SECREt = 'Password'

CREATE EXTERNAL DATA SOURCE [RemoteData] WITH (TYPE = RDBMS, LOCATION = N'servername.database.windows.net', CREDENTIAL = [CredentialJM], DATABASE_NAME = N'databasename')
GO
CREATE EXTERNAL TABLE [dbo].[TableNameSynapse]
([id] [int] NOT NULL)
WITH (DATA_SOURCE = [RemoteData])

 

 

2)  Finally, I was able to run and obtain data from the table TableNameSynapse without issues. 

 

3) Just wanted to comment one thing that it is very important, even if you create a PrivateLink for Synapse server and you specified in the firewall Deny public network access, always the connection will be stablished from the Azure public IP of the machine that is running your Azure SQL Database never with the private IP. Remember that the Private Link is for incoming connection request not outbound connection request. Also, remember that instead opening the Deny public network access you could use Allow Azure services and resources to access this server.

 

Enjoy!

 

1 Comment
Version history
Last update:
‎Oct 22 2020 07:21 AM
Updated by: