0
votes

Here is my scenario: My Database is on MongoDB Atlas. I need to access Atlas from Azure Function(Dynamic/Consumption Plan) and App Service. In doing so, I am facing A timeout issue. I know, this is because I have to whitelist outbound IP addresses of Azure Function and App Service Plan in Atlas. But Azure Function(with Consumption Plan) and App Service update their outbound IP addresses during the autoscaling process. Now there are 2 solutions I can think of:

  1. Whitelist all the IP addresses of an Azure Region/Zone. But this is not an ideal approach, as a single Zone may have many(500~1000 or more) IP addresses.
  2. Using the VPC peering. I guess we may connect Azure and Atlas through VNET. However, to do that, I need to connect the Azure function and App Service to Vnet first. The problem is VNET Integration with these services is a very expensive approach.

So my question is what other options do I have? Is there any way to connect them using some managed identity or Authentication/Authorization approach using Azure AD or something like that? Is Federated Authentication fits for such a case?

1

1 Answers

0
votes

You can use App Service Environment

App Service Environments use dedicated network infrastructures, so apps running in an App Service environment get static, dedicated IP addresses both for inbound and outbound connections.

See: https://docs.microsoft.com/en-us/azure/app-service/overview-inbound-outbound-ips

Another solution would be to place your app behind a Firewall and give the firewall a static IP address.