Reputation: 1465
I created a Subnet, where I connect a Cosmos DB as Service Endpoint. Besides the IP firewall of the Cosmos DB I want to control the Outbound via NSG rules. However if I create a rule, that denies all Outbound (also tested with deny all Inbound) it seems to have to effect, when connecting to the DB via the Mongo client.
Is this expected behaviour ?
Upvotes: 0
Views: 1433
Reputation: 28284
Yes, It's expected behavior when access the Cosmos DB from service endpoint enabled VNet. Here are two points in your question:
Today, Azure service traffic from a virtual network uses public IP addresses as source IP addresses. With service endpoints, service traffic switches to use virtual network private addresses as the source IP addresses when accessing the Azure service from a virtual network. This switch allows you to access the services without the need for reserved, public IP addresses used in IP firewalls.
So, if you are accessing the Cosmos DB from a VNet, it will use the private IP address in that VNet to access the Azure Cosmos DB service. If you are accessing the Cosmos DB outside of Azure, you will be restrcited by the firewall IP address of the Cosmos DB.
Upvotes: 2