How to connect to cosmosDB which is in private VNET from Logic apps

Debashis Jena 71 Reputation points
2023-06-02T13:51:14.52+00:00

Hi,

We have a Cosmos DB that is configured in private endpoint, now how can we connect to this Cosmos DB account from Logic App. Since there is no networking in Logic Apps we wanted to know how we can connect Logic Apps to Cosmos DB.

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,994 questions
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,539 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. VasimTamboli 4,785 Reputation points
    2023-06-02T15:26:14.8033333+00:00

    To connect Azure Logic Apps to a Cosmos DB account that is configured with a private endpoint, you can follow these steps:

    Create a virtual network integration for your Logic App:

    • In the Azure portal, navigate to your Logic App resource.
    • Under the "Settings" section, click on "Networking".
    • Enable the "Enable virtual network integration" option.
    • Select the virtual network and subnet that has connectivity to your private endpoint-enabled Cosmos DB account.
    • Save the changes.

    Configure the private endpoint connection for your Cosmos DB account:

    • In the Azure portal, navigate to your Cosmos DB account.
    • Under the "Settings" section, click on "Private endpoint connections".
    • Click on the "+ Add" button to add a new private endpoint connection.
    • Select the virtual network and subnet that you configured for your Logic App.
    • Save the changes.

    Update your Logic App connection:

    • Open your Logic App in the Azure portal.
    • Navigate to the Logic App designer and find the action or trigger that requires the Cosmos DB connection.
    • Edit the connection for the Cosmos DB action or trigger.
    • Select the appropriate Cosmos DB account from the connection list.
    • Save the changes.

    By completing these steps, you have established a private network connection between your Logic App and the Cosmos DB account through the virtual network integration and private endpoint. This allows your Logic App to securely access the Cosmos DB account using the private endpoint.

    Make sure that your virtual network and subnet have the necessary connectivity to reach the private endpoint-enabled Cosmos DB account.

    Note: If you are using a consumption-based Logic App, virtual network integration is not available. In such cases, you may need to consider using other methods such as Azure Functions or Azure Logic Apps Integration Service Environment (ISE) that support private endpoints and have dedicated networking capabilities.

    Please refer to the Azure documentation for more detailed guidance on configuring private endpoints for Cosmos DB and connecting Logic Apps to private endpoint-enabled resources.