In our earlier article we have seen how to install and configure the MongoDB on to a Windows Azure Virtual Machine and access it locally with in the server. Now we will see how to configure the end points and get the access to the outside environment by setting the appropriate end points. Please refer to Part 1 of this article to see how to Install and Configure the MongoDB on Windows Azure Virtual Machine to get some continuation of the process. [more]
Steps:
Now we have the MongoDB ready to use and can be accessed locally, we need to configure it such that it can be accessed from the external systems to communicate. Let us start with setting up the inbound rules, to do that click on Start and go to Administrative Settings and select Windows Firewall with Advanced Security as shown in the screen below.
Click in the Inbound Rules and create a new Rule as shown in the screen below. We can see a wizard where we need to configure the Inbound Rules that are allowed to connect to the database.
We can see a Wizard opens and have the option to select a Program or a port that are to be configured. We can select a particular program level rule to configure or we can configure it based on the port. Let us do it by Port, to do that select PORT option and click on Next to proceed further as shown in the screen below.
We need to set the Port on which the MongoDB listens to. MongoDB uses the port 27017 port which is over the TCP protocol that is used by the database. So select TCP and enter the port 27017 and click on Next as shown in the screen below.
Next screen provides option to how the connection to be secured. Select Allow Connection option from the list and click on Next button as shown in the screen below.
We can see next a list of options to which the rule should apply, since by default it applies to all the options click on Next directly without changing any option as shown in the screen below.
Now we are the final stage, specify a valid name to the port like MongoDBPort or something which best describes the requirement of the port configured and click on Finish as shown in the screen below.
We can see the port is configured and a new Rule is added which is listed in the list of available rules as shown in the screen below.
So we are done with enabling a port where the MongoDB listens to the server, next is to configure the Endpoints which can be done from the Management Portal. Login to the Management portal and go to the Virtual Machine environment and select the virtual machine where we are going to configure the end point as shown in the screen below.
At the bottom menu click on Add Endpoint option which basically provides a screen to add the end point to which we have configured the port in the server as shown in the screen below.
Enter the port which we configured in the server (27017) by providing the required fields as shown in the screen below and click on Finish to add the end point to the virtual machine.
Now we have made a port where the MongoDB is accessible from the server. So essentially all the rules are provided to access the port through which we can access the Database. That’s it from this tutorial, we will see in detail on how to use this DB in real time in a ASP.NET application and host it to the Azure environment in our upcoming sessions.