I have a web app on Azure that connect to a MongoDB cluster hosted on Atlas (cloud.mongodb.com).
I'd like to use Atlas so I don't have to care about MongoDb configurations. The issue is that I get a timeout connecting my cluster. I have to set the app service ip in my mongo cluster whitelist, but If I try to download the page http://www.whatsmyip.org/ I get every time a different IP.
On the azure panel I've tried everything, set a VNET integration, set an ASE, a gateway. I really don't know how to expose the public IP.
However I have a VM that can query the mongo cluster, it has a Network interface with a public ip and a nsg (firewall).
To expand Paolo's answer as it wasn't too clear and I had to do some extra research.
In the Azure portal, select your App Service and scroll down to the Settings section in the menu (headed by overview) and select properties.
Scroll down until you find the Outbound IP Addresses. These are the ones you will want to add to your whitelist in Atlas.
Useful Links: https://blogs.msdn.microsoft.com/waws/2017/02/01/how-do-i-determine-the-outbound-ip-addresses-of-my-azure-app-service/
You can whitelist 0.0.0.0/0 and then rely on user authentication. Alternatively, you can use AWS as an alternative to Azure and use VPC peering.
https://www.mongodb.com/blog/post/introducing-vpc-peering-for-mongodb-atlas
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With