Tuesday, June 15, 2021

Lesson Learned #175: Connecting to Private EndPoint of Azure SQL Database from Managed Instance

Today, I worked on a very interesting case when our customer wants to connect to the Private EndPoint/Link of Azure SQL Database from Azure SQL Managed Instance. In this article, I would like to share with an example how to do it. 

 

Basically, once you have created the Private Endpoint on the VNET/SUBNET of your Azure SQL Managed Instance. The most important thing is to resolve the IP. We have two options:

 

  • Adding in your DNS server the resolution for your Azure SQL Database Private EndPoint IP.
    • For example, servername.database.windows.net points to 10.1.2.5. If you have already deployed you Azure SQL Managed Instance before creating this Private Endpoint in order to update the DNS resolution of your Azure SQL Manage Instance nodes, I would like to suggest to scale up/down your Azure SQL Managed Instance in order to refresh the DNS servers.
  • Connecting using the IP address of your Private Endpoint.
    • In the Linked Server definition, type a name (for example, MyLinkedServerWithPrivateEndpoint), choose any provider in the data source type the Private Endpoint IP that you have, for example, 10.1.2.5 and finally, in the catalog type the name of your database. 
    • For login credentials, you need to specify:
      • UserName: myloginname@servername (without adding .database.windows.net)
      • Password: Type the password of this login.

 

LinkedServer.png

LinkedServer2.png

In this situation, everytime that you run a query, for example, SELECT * FROM MyLinkedServerWithPrivateEndpoint.DatabaseName.SchemaName.TableName you are going to directly to the Private Endpoint. This applies for Azure SQL Database and Azure Synapse. 

 

Enjoy!

 

Posted at https://sl.advdat.com/3gEuiWk