Jump to content

Synapse Connectivity Series Part #2 - Inbound Synapse Private Endpoints


Recommended Posts

Guest FonsecaSergio
Posted

This is part 2 of a series related to Synapse Connectivity - the link below references the previous blog article:

 

 

 

 

This blog article will feature Synapse Private Endpoint. The foundation of this article was based on a previous post - Azure SQL DB Private Link / Private Endpoint - Connectivity Troubleshooting) which I will go more in depth with Synapse specific features.

 

 

 

This post does not cover: Managed Private Endpoints that are private endpoints, but from Synapse resources (ADF / Spark) to reach external resources. I will have this covered in the next blog article of this series.

 

 

 

In this article we are going to explore:

 

1 - What is the Private Endpoint for Synapse?

 

2 - Creation of Private Endpoint

 

  • 2.1 - Creation of SQL, SQLOnDemand, Dev endpoints
  • 2.2 - Creation of Web endpoint

 

3 - Name resolution

 

4 - Scenario: Azure VM > Private Endpoint (Azure DNS)

 

5 - Scenario: OnPrem VM > VPN (P2S) > Private Endpoint (Hosts File)

 

6 - Scenario: Azure VM > Private Endpoint (Custom DNS)

 

7 - Scenario: OnPrem VM > VPN (P2S) > Private Endpoint (Custom DNS)

 

8 - Scenario: Power BI > Data Gateway > Private Endpoint

 

9 - Troubleshooting

 

  • 9.1 - Private endpoint exists, but still failing to connect or still connecting to public endpoint
  • 9.2 - Synapse Studio failing to load resources

 

 

 

1 - What is the Private Endpoint for Synapse?

 

 

Azure Private Endpoint is a network feature in Microsoft Azure that enables you to access Azure PaaS (Platform as a Service) services, like Azure Storage, Azure SQL Database and Synapse, over a private network connection. Private Endpoint provides private connectivity from your on-premises or virtual network to Azure PaaS services over a Microsoft-managed network.

 

 

 

The traffic between your virtual network and the service travels the Microsoft backbone network. Exposing your service to the public internet is no longer necessary.

 

 

 

In the image below we can see how the connection using private endpoint works. And as mentioned on the other last post Synapse clients by default will try go by default to the public gateway IPs (Azure Synapse Analytics connectivity architecture). With the usage of private endpoints you can close the public path and users can only connect from private endpoint.

 

 

 

If you have multiple Azure VNETs you will need to use VNET peering or VNET VPN between two Azure VNETs, or P2S,S2S or Express Route to connect your onprem to Azure Network as we can see on below image

 

 

 

mediumvv2px400.png.774a8cd26260c74245ed3d78c5b207ae.png

 

 

 

But when working with Synapse, its not just one endpoint (SQL) but multiples of them (SQL, Serverless, DEV, Web, Datalake). To have a full picture, I'm adding the multiple endpoints and I'm adding also DNS name resolution that will be essential in private connection and for you to have a full picture in mind. We will also explain it later in this post.

 

 

largevv2px999.png.50bc196c50927b194336b0a6624d754b.png

 

 

 

Let us start by reviewing how to create these private endpoints.

 

 

 

2 - Creation of a Private Endpoint

 

 

To create the private endpoints just follow the step-by-step procedure documented at

 

 

 

 

2.1 - Creation of SQL, SQLOnDemand, Dev endpoints

 

 

The creation steps may change if you are using a Synapse or Former SQL DW connected to Synapse. Make sure to check

 

What's the difference between Azure Synapse (formerly SQL DW) and Azure Synapse Analytics Workspace.

 

 

 

This table shows the differences related with private endpoints:

 

 

 


Synapse Workspace

Former SQL DW + Connected Synapse Workspace

[attachment=29775:name]

[attachment=29776:name]

For Synapse Workspace you have private endpoints:

  • SERVERNAME.sql.azuresynapse.net (Created on Synapse workspace)
  • SERVERNAME-OnDemand.sql.azuresynapse.net
  • SERVERNAME.dev.azuresynapse.net

For Former SQL DW you have:

  • SERVERNAME.database.windows.net (Created on SQL Logical Server)
  • SERVERNAME-OnDemand.sql.azuresynapse.net
  • SERVERNAME.dev.azuresynapse.net

In a Synapse Workspace you can create all 3 endpoints (SQL, Dev and OnDemand:(

 

 

 

2.2 - Creation of Web endpoint

 

 

The Web private endpoint is not related with resource type Microsoft.Synapse/workspace or Microsoft.Sql/servers, but on Microsoft.Synapse/privateLinkHubs:

 

 

 

mediumvv2px400.png.172f23dbb17d9e280d90a4683776108d.png

 

Connect to Azure Synapse Studio using Azure Private Link Hubs

 

 

 

IMPORTANT NOTE !!!

 

The Synapse Private Link Hub is not attached to any workspace. That means that you will NOT need to have Synapse Private Link Hub for each environment (DEV Synapse Private Link Hub / QUA Synapse Private Link Hub / PROD Synapse Private Link Hub), etc... UNLESS your networks / DNS Servers are different. Like one network for dev network and different network for production.

 

 

 

You actually need 1 Synapse Private Link Hub per DNS, because at end of your day you will have VMs that will use same DNS to access and resolve private endpoint for web.azuresynapse.net. - sample provided

 

 

 

nslookup web.azuresynapse.net

 

Server: XXXXXX.internal.cloudapp.net

Address: 10.0.0.5

 

Non-authoritative answer:

Name: web.privatelink.azuresynapse.net

Address: 10.0.1.10

Aliases: web.azuresynapse.net

 

 

 

When you access Synapse Studio (using Private or Public web endpoint), to connect and load information from a workspace, your machine will access the Synapse endpoints (Dev, SQL, Serverless) that can also be Private or Public. The web interface will not access Synapse endpoints on your behalf.

 

mediumvv2px400.png.caea828c052a57350b08304067365d79.png

 

 

 

I've also provided additional troubleshooting steps at end of this post that explains in detail how to troubleshoot this scenario, refer to section 9.2 - Synapse Studio failing to load resources.

 

 

 

You may also want to close all public network access to make sure all connections flow from the private endpoint.

 

mediumvv2px400.png.72cbf692b563d2ec0134be31ef5f9f03.png

 

 

 

To learn more, check out Azure Synapse Analytics connectivity settings.

 

 

 

3 - Name resolution

 

 

You must use the FQDN to connect to Synapse as documented at Azure Private Link for Azure SQL Database and Azure Synapse Analytics

 

 

 

Use the
Fully Qualified Domain Name (FQDN)
of the server in connection strings for your clients (<server>.database.windows.net / <server>.sql.azuresynapse.net).
Any login attempts made directly to the IP address or using the private link FQDN (<server>.privatelink.database.windows.net / <server>.privatelink.sql.azuresynapse.net) shall fail
. This behavior is by design, since private endpoint routes traffic to the SQL Gateway in the region and the correct FQDN needs to be specified for logins to succeed.

 

 

The image below provides a more detail depiction.

 

largevv2px999.png.9a379bc7583998cb00a96b4d1da5dd90.png

 

 

If you try to connect using private endpoint IP or custom DNS name, and even privatelink alias you are going to get the following error:

 

 

 

 

===================================

- Cannot connect to 12.1.1.6.

- Cannot connect to mysynapse.mydomain.com.

- Cannot connect to SERVERNAME.privatelink.sql.azuresynapse.net.

===================================

A connection was successfully established with the server, but then an error occurred during the login process.

(provider: SSL Provider, error: 0 - The target principal name is incorrect.) (.Net SqlClient Data Provider)

===================================

 

 

 

You will need to use some kind of name resolution solution to get you connected, to learn more check out the following links:

 

 

 

It's important to correctly configure your DNS settings to resolve the private endpoint IP address to the fully qualified domain name (FQDN) of the connection string.

 

 

 

You can use the following options to configure your DNS settings for private endpoints:

 

  • Use the host file (only recommended for testing). You can use the host file on a virtual machine to override the DNS.
  • Use a private DNS zone. You can use private DNS zones to override the DNS resolution for a private endpoint. A private DNS zone can be linked to your virtual network to resolve specific domains.
  • Use your DNS forwarder (optional). You can use your DNS forwarder to override the DNS resolution for a private link resource. Create a DNS forwarding rule to use a private DNS zone on your DNS server hosted in a virtual network.

 

 

 

Important: It's not recommended to override a zone that is actively in use to resolve public endpoints. Connections to resources won't be able to resolve correctly without DNS forwarding to the public DNS. To avoid issues, create a different domain name or follow the suggested name for each service below.

 

 

 

 

Your applications don't need to change the connection URL. When attempting to resolve using a public DNS, the DNS server will now resolve to your private endpoints. The process does not impact your applications.

 

 

 

The following sample scenarios will guide you on how to get it resolved:

 

 

 

4 - Scenario: Azure VM > Private Endpoint (Azure DNS)

 

 

From an Azure VM deployed to same VNET and using Azure DNS (168.63.129.16), if we test command below on command prompt BEFORE you create the Private Endpoint.

 

 

 

nslookup SERVERNAME.sql.azuresynapse.net

 

 

 

You will get result like below that shows that this server is using public gateway IP: 104.40.168.105. So NOT using any private IP

 

Server: UnKnown

Address: 168.63.129.16

 

Non-authoritative answer:

Name: cr4.westeurope1-a.control.database.windows.net

Address: 104.40.168.105 (This is Synapse public gateway IP range - Azure SQL Database and Azure Synapse Analytics connectivity architecture)

Aliases:

SERVERNAME.sql.azuresynapse.net

SERVERNAME.database.windows.net

synapsedataslice1.westeurope.database.windows.net

 

 

 

After you create the private endpoint, you will get the following result. SAME FQDN used but resolving to private IP

 

nslookup SERVERNAME.sql.azuresynapse.net

 

Server: UnKnown

Address: 168.63.129.16

 

Non-authoritative answer:

Name: SERVERNAME.privatelink.sql.azuresynapse.net

Address: 10.0.1.6

Aliases: SERVERNAME.sql.azuresynapse.net

 

 

 

 

Be sure to also to open outbound communication from Azure VM VNET to Private Endpoint on Local Firewall, Corporate Firewall, or Azure NSGs to required ports. For more information, check out Azure Synapse Analytics IP firewall rules.

 

 

 

Important !!!

 

Don't forget to add virtual network link from Private Zone to the VNET where name resolution is happening. In this scenario the VNET where client lives.

 

 

 

mediumvv2px400.png.b78ea160428153469f4565fbee2af04c.png

 

 

 

 

 

mediumvv2px400.png.43640060715569e0c60dddedc5581af9.png

 

 

 

mediumvv2px400.png.d3fb2f19f4a46d7a10ab73424ef26686.png

 

 

 

5 - Scenario: OnPrem VM > VPN (P2S) > Private Endpoint (Hosts File)

 

 

If you need to connect from your Onprem VM to Azure VNET you can use the template below to create the VPN Point-to-Site (P2S)

 

 

 

 

After creating the VPN, downloading, and installing the VPN client and connecting to it

 

mediumvv2px400.png.43692ba19c36adbe516b424952707c37.png

 

 

 

Check name resolution

 

nslookup SERVERNAME.sql.azuresynapse.net

 

 

 

Pay attention to what DNS is being used in your scenario. In this test, we can see that it is using My test DNS server

 

Server: XXXXXX.internal.cloudapp.net

Address: 10.0.0.5 (My DNS Server)

 

Non-authoritative answer:

Name: cr4.westeurope1-a.control.database.windows.net

Address: 104.40.168.105 (Resolving to public)

Aliases: SERVERNAME.sql.azuresynapse.net

SERVERNAME.privatelink.sql.azuresynapse.net

SERVERNAME.database.windows.net

synapsedataslice1.westeurope.database.windows.net

 

 

 

My DNS is not able to resolve to private, as a workaround or as a test, we can use Windows HOSTS file (C:\Windows\System32\drivers\etc\hosts).

 

 

 

*Don't forget to run notepad as an admin to be able to change this file

 

 

 

mediumvv2px400.png.b0b7728c35a97f482d9cafbc319dec1f.png

 

*Do not forget to add all private IPs needed like SQL, Ondemand and Dev

 

 

 

And we are able to connect successfully. You will be able to check and get your private IP using TSQL below running on master DB

 

 

 

SELECT client_net_address

FROM sys.dm_exec_connections

where session_id = @@SPID

 

 

 

mediumvv2px400.png.29d02c721cfecbf6d30fe06f800efc11.png

 

 

 

 

 

6 - Scenario: Azure VM > Private Endpoint (Custom DNS)

 

 

There are multiple scenarios on how you can use custom DNS. Make sure to check all options at Azure Private Endpoint DNS configuration

 

 

 

On Azure Virtual Network settings I've replaced default Azure DNS with custom DNS (On my tests 10.0.0.5).

 

 

 

mediumvv2px400.png.0c71e352d3630182f36afa56c2dc47ad.png

 

 

 

 

 

If your client lives in Azure, the DNS on VM can be a forwarder to Azure DNS

 

mediumvv2px400.png.e880c853cd8d1b83eb7c3d9a8be37627.png

 

 

 

 

 

- Go to DNS > Domain > Properties > Forwarders

 

- Add Azure DNS (168.63.129.16)

 

 

 

*In this case I'm forwarding everything to Azure DNS. In the next part I will explain the conditional forwarder

 

 

 

mediumvv2px400.png.6004f5e79f1b8760a3996ddb762f6b6c.png

 

 

 

 

 

 

 

Important !!!

 

Do not forget to add virtual network link from Private Zone to the VNET where name resolution is happening. In this scenario the VNET where DNS VM lives, not with final client VM.

 

 

 

mediumvv2px400.png.1628ac39f3c785ae3bb36cf804bb0ca0.png

 

 

 

mediumvv2px400.png.a5171c7f0a8dc8fcd5306f473e364060.png

 

 

 

mediumvv2px400.png.122e92ed85858fa8c15943997094c982.png

 

 

 

7 - Scenario: OnPrem VM > VPN (P2S) > Private Endpoint (Custom DNS)

 

 

There are multiple scenarios how you can use custom DNS. Make sure to check all options at Azure Private Endpoint DNS configuration

 

 

 

If you have an onprem DNS you may need a Conditional forwarder

 

mediumvv2px400.png.ac6d7db43ba2ae28053a830227bf794f.png

 

 

 

 

 

 

 

Go to DNS > Domain > Conditional Forwarders > New

 

mediumvv2px400.png.97ae5ca7d3973525619590480c139fa9.png

 

 

 

You may need multiple conditional forwarders one for each zone

 

  • Conditional forwarder for DNS Domain database.windows.net. DO NOT USE privatelink.database.windows.net
  • Conditional forwarder for DNS Domain sql.azuresynapse.net. DO NOT USE privatelink.sql.azuresynapse.net

 

To learn more, check out On-premises workloads using a DNS forwarder

 

 

 

mediumvv2px400.png.64693c95f2d9c481b09da8453a837c02.png

 

 

 

And you can check if name resolution is successful

 

nslookup SERVERNAME.sql.azuresynapse.net

 

Server: XXXXXX.internal.cloudapp.net

Address: 10.0.0.5 (My DNS Server)

 

Name: SERVERNAME.privatelink.sql.azuresynapse.net

Address: 10.0.1.6

Aliases: SERVERNAME.sql.azuresynapse.net

 

 

 

As mentioned in the previous scenario:

 

 

 

Important !!!

 

Do not forget to add virtual network link from Private Zone to the VNET where name resolution is happening. In this scenario the VNET where DNS VM lives, not with final client VM.

 

 

 

mediumvv2px400.png.24a3c25b5f0b68b9c11174a23559ffb3.png

 

 

 

mediumvv2px400.png.68225665b64a1def8c36621c8f2cd441.png

 

 

 

mediumvv2px400.png.40d8aa76b6a6a65a1002627b3172f92a.png

 

 

 

If you do not want to use forwarder you can also create a forward lookup zone and add manually the host to match the FQDN. This might be a problem as you will need to add all names / IP manually

 

mediumvv2px400.png.998c0962b6bf01ccbbd110a1aa1fcda2.png

 

 

 

8 - Scenario: Power BI > VNET integration > Private Endpoint

 

 

To make Power BI or Power Platform to connect to a Synapse private endpoint you will need to use a Data Gateway, these PaaS services are not part of your Azure Network. To learn more, check out On-premises data gateway - Power BI

 

largevv2px999.png.676f15ac06aeca717668ca0c51a35060.png

 

 

 

To learn more about on-premises data gateway, check out On-premises data gateway architecture.

 

mediumvv2px400.png.d401df9d875703bacb74886002cc2db5.png

 

 

 

There is also aa VNET Data gateway, but until time I'm writing this post (2022-12-30) it's still in Preview

 

 

 

mediumvv2px400.png.ea9e65bec5c8d08683cd6a4a68724693.png

 

 

 

For more details, check out What is a virtual network (VNet) data gateway (Preview)?

 

 

 

9 - Troubleshooting

 

9.1 - Private endpoint exists, but still failing to connect or still connecting to public endpoint

 

 

 

 

 

To make sure you are using a private connection, there are 3 requirements:

 

  • Path / Route
    • You need make sure your client is able to reach your private endpoint IP
      • Using VPN, ExpressRoute or just being an Azure VM that is already part of the Azure VNET, but even in this case need to make sure Client VNET communication can flow to VNET where Private endpoint was creates

      [*]You need to make sure Private endpoint is healthy and approved

    [*]Name

    • You need to get FQDN like SERVERNAME.SQL.azuresynapse.net or SERVERNAME.DEV.azuresynapse.net or STORAGEACCOUNT.dfs.core.windows.net and have it resolve to a private IP created not to the public one
      • But I have a private IP can I use it directly. NO!
      • Can I create a customer name Synapse.MyDomain.com. NO!

      [*]You can check all private endpoints manually below

 

NSLOOKUP SERVERNAME.database.windows.net

NSLOOKUP SERVERNAME.sql.azuresynapse.net

NSLOOKUP SERVERNAME-ondemand.sql.azuresynapse.net

NSLOOKUP SERVERNAME.dev.azuresynapse.net

NSLOOKUP web.azuresynapse.net

NSLOOKUP STORAGEACCOUNT.dfs.core.windows.net

 

 

 

We have also seen customer issues where it was actually on an Internet proxy, so when connecting to Synapse Studio, name resolution is not happening locally but on proxy server.

 

 

 

mediumvv2px400.png.5b9ae0e02f90a23167988d2b3de8eec3.png

 

 

 

  • Port
    • Is the port needed open? Samples below
      • For SQL endpoint - SERVERNAME.SQL.azuresynapse.net
        • 1433 for SSMS or PowerBI
        • 1443 or 443 for Synpse Studio

        [*]For DEV endpoint - SERVERNAME.DEV.azuresynapse.net

        • 443

        [*]More details can be found at Azure Synapse Analytics IP firewall rules

        [*]You can check ports manually using Powershell commands below

 

Test-NetConnection -Port 1433 -ComputerName SERVERNAME.database.windows.net

Test-NetConnection -Port 1433 -ComputerName SERVERNAME.sql.azuresynapse.net

Test-NetConnection -Port 1443 -ComputerName SERVERNAME.sql.azuresynapse.net

Test-NetConnection -Port 443 -ComputerName SERVERNAME.sql.azuresynapse.net

 

Test-NetConnection -Port 1433 -ComputerName SERVERNAME-ondemand.sql.azuresynapse.net

Test-NetConnection -Port 1443 -ComputerName SERVERNAME-ondemand.sql.azuresynapse.net

Test-NetConnection -Port 443 -ComputerName SERVERNAME-ondemand.sql.azuresynapse.net

 

Test-NetConnection -Port 443 -ComputerName web.azuresynapse.net

Test-NetConnection -Port 443 -ComputerName SERVERNAME.dev.azuresynapse.net

 

 

 

 

 

You can also use the following script to test all endpoints needed, to check if they are resolving to private or to public and if ports are open

 

 

 

We can see what endpoints are resolving to private and which are public. In this case, the database is resolving to public as expected, because it's not a Former SQL DW.

 

mediumvv2px400.png.e7d448e0956288fde06a5e22b1b8c8c8.png

 

 

We can also see ports are open

 

mediumvv2px400.png.9164c276cfc75f8ab54aeee7b78663cb.png

 

 

 

This other script also good to use as it will actually make the API calls and check for failures. To learn more, check out Troubleshoot Synapse Studio connectivity with PowerShell

 

 

 

9.2 - Synapse Studio failing to load resources

 

 

When you are trying to reach Synapse Studio you may face the following error: (Example: Your machine tried to reach one API but failed to load)

 

mediumvv2px400.png.b8f5e80805446807a1ce2180884bbfda.pngmediumvv2px400.png.029900ab9b6c2e004a39bd72383c833d.png

 

 

 

 

 

When you use Synapse Studio, it is NOT the web interface accessing Synapse resources. It is your machine making the API calls directly to Synapse. You will need to see if your machine is resolving them to private or public endpoints

 

 

 

If you debug Synapse Studio you will notice that your machine calling Synapse APIs is failing, so your machine will need to resolve FQDN to connect to Synapse APIs (For more details, check out Capture a browser trace for troubleshooting)

 

 

 

You will also notice that some APIs may succeed while others may fail

 

 

 

Sample 1 - OnDemand API call failed

 

largevv2px999.thumb.png.a26fc475156366dfd08231324feb0f21.png

 

 

 

In this test, notice the port could not be reached. (In this case, I forced an error forcing connection to incorrect IP 127.0.0.1)

 

Test-NetConnection -Port 443 -ComputerName SERVERNAME-ondemand.sql.azuresynapse.net

WARNING: TCP connect to (127.0.0.1 : 443) failed

 

ComputerName : SERVERNAME-ondemand.sql.azuresynapse.net

RemoteAddress : 127.0.0.1

RemotePort : 443

InterfaceAlias : Loopback Pseudo-Interface 1

SourceAddress : 127.0.0.1

PingSucceeded : True

PingReplyDetails (RTT) : 0 ms

TcpTestSucceeded : False

 

 

 

You may also see it on console view

 

mediumvv2px400.png.4146f5ba42816d84d00226362ec550bb.png

 

 

 

You may ask, is the dedicated pool information showing correctly? The other API (management.azure.com) has succeeded in the example below.

 

 

 

*Pay attention to the below REMOTE ADDRESS. It's your machine resolving the name to the public IP and port.

 

largevv2px999.png.f2f0b5be36536353ff84d16d6f9ca7e3.png

 

 

 

Below we can see API Request result being applied while other failed

 

largevv2px999.thumb.png.3bfb7aa2d7d4492e57d1ec9ff300a181.png

 

 

 

 

 

Hope this post provides you the guidance on how to deal and troubleshoot Synapse Private Endpoints. If you need more details or have questions, please provide a comment below.

 

 

 

References and links

 

 

Continue reading...

mediumvv2px400.png.47f8320921feb64c99e1632602a08a53.png

mediumvv2px400.png.d2d2830ad16e021ae788b3be80df4883.png

mediumvv2px400.png.c61f6d3d8044eb9ebe2640ff76e430b2.png

mediumvv2px400.png.55c7b5a8ed67b9642ac6eda176a67bd6.png

mediumvv2px400.png.4b9dbbf5af10af95deafd5235940164b.png

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...