How to connect an app service with private endpoint and cosmos db with private endpoint in different Vnet

Mohamed Jbeli 0 Reputation points
2023-08-02T21:44:08.8033333+00:00

I have 2 Vnets :
Vnet1 ="cosmos-db-vnet" with "private_subnet" in which the cosmos-db and its private endpoint are created
Vnet2 ="client-vnet" with "private_subnet" in which the app service and its private endpoint are created and another subnet "subnet_out" for Vnet integration of the app service
I have enabled Vnet peering between the two vnets but my java code running inside the the app service can't connect to the mongo db I get a read timeout
I guess the problem is the app sends traffic through the subnet_out with a certain ip and the cosmos respond at the same
I want some helpful thoughts that I can implement

Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,711 questions
Azure Private Link
Azure Private Link
An Azure service that provides private connectivity from a virtual network to Azure platform as a service, customer-owned, or Microsoft partner services.
540 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,658 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sam Cogan 10,807 Reputation points Microsoft Employee
    2023-08-03T07:43:52.73+00:00

    By peering the networks you allow communication to the Private Endpoint, however to resolve the name you will need to link the Private DNS zone that has your Private Endpoint DNS records in it, to both vNets.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.