I have setup a MongoDB replica cluster on 3 virtual machines (Ubuntu 14), on MS azure cloud. The mongodb cluster has been setup with MMS (https://mms.mongodb.com amazing tool btw) and it works fine.
I have also an azure website with PHP, the mongodb driver has been installed.
Now I want to connect my website to my mongoDB cluster master and of course, I don't want to open the port 27017 to anyone, how should I configure it?
In September, Azure Websites gained support for Virtual Networks. If you have your MongoDB cluster configured to be in a virtual network, you can now add your website to that same virtual network. Once you do this, you can have your MongoDB driver access the nodes directly (via internal IP address for each node), rather than needing to open external endpoints.
As of now, you'll need to use the new portal (portal.azure.com) to configure your Website to be in a vnet.
The announcement post is here. There's also a tutorial posted here.