While it's possible to paste a MongoLab URI into your code, we recommend configuring it in the environment for ease of management. This way, if the URI changes, you can update it through the Azure Portal without going to the code.
- In the Azure Portal, select Web Apps.
- Click the name of the web app in the Web Apps list.
The Web App dashboard displays. - Click Configure in the menu bar.
- Scroll down to the Connection Strings section.
- For Name, enter MONGOLAB_URI.
- For Value, paste the connection string we obtained in the previous section.
- Select Custom in the Type drop-down list (instead of the default SQLAzure).
- Click Save on the toolbar.
Note: Azure adds the CUSTOMCONNSTR_ prefix to this variable, which is why the code above references CUSTOMCONNSTR_MONGOLAB_URI.