Connect to private SQL database with Logic Apps Single tenant (Preview)
Published May 14 2021 02:08 AM 5,708 Views
Copper Contributor

 

One of the major limitations with multi-tenant logic app was its inability to integrate with private resources (that are behind a firewall and/or deny public connections). Integration service environment  (ISE) was one solution to achieve this task. But there is certain limitations in using ISE and that's a different topic for discussion.

Let's see how to integrate single tenant logic app with private resources.

 

  1. Create a Single tenant logic app and workflow. I am using a HTTP trigger to start the workflow.

Add an action and search for SQL. We can see two connector options. Built-in and Azure.

 

Haris_Abdulkareem_0-1619326184569.png

 

Private connection is possible only using the built-in actions. If we use Azure action, we will have to whitelist the connector outbound IP ranges (public) in the destination system firewall.

 

At the moment, we have only one built-in action for SQL that is 'Execute SQL query'. More built-in actions are expected to be added in the future.

 

  1. To create a built-in SQL connection we can use connection string. We can obtain the connection string from SQL database and add the password to create the action. For this example, I use a select query to one of the tables in the SQL database. I will add a response action to complete the workflow design. Let's use the result of SQL action in the response using Dynamic content.

 

If the SQL server is currently not behind a firewall and 'Allow Azure services and resources to access this server' flag is set to Yes we can test the logic app and make sure it is working fine.

Let's use the HTTP URL that is generated when the workflow is saved in an API testing tool (like Postman) to trigger the logic app. I tested and got the response with the SQL query results.

 

If the SQL server is already behind a firewall and (or) if it denies public connections, workflow would not be able to connect at the moment. We need to create a private endpoint for the Azure SQL server that we need to connect from logic app workflow.

 

We get below error in workflow (without a private endpoint).

 

Haris_Abdulkareem_1-1619326184571.png

 

 

  1. Let's create a private endpoint in the SQL server.
     

Private endpoint enables connectivity between the consumers from the same VNet, regionally peered VNets, globally peered VNets and on premises using VPN or Express Route and services powered by Private Link.

 

Reference: https://docs.microsoft.com/en-us/azure/private-link/private-endpoint-overview

 

Haris_Abdulkareem_2-1619326184573.png

 

Select the resource.

 

Haris_Abdulkareem_3-1619326184574.png

 

 

Next step, choose a virtual network and subnet for the private endpoint. We need to integrate the private endpoint with a private DNS zone.

Haris_Abdulkareem_4-1619326184576.png

 

 

 

  1. After the private endpoint is created, let's deny the public network access.

 

Haris_Abdulkareem_5-1619326184577.png

 

 

Test the logic app again. Now we are able to integrate a logic app with a private SQL server using private endpoint. Please let me know your questions or thoughts via comments below.

Co-Authors
Version history
Last update:
‎May 14 2021 02:08 AM
Updated by: