Using Azure Document DB as Mongo Provider

Posted 7 December 2016 12:00 AM by Vicent Galiana, Sitecore Solutions Architect @ ClearPeople

Since Document DB started supporting Mongo's protocol I was wondering if we could have Sitecore running on Document DB. And today I managed to get it running. It threw a couple of exceptions the first time, but since then I don't see any error and, apparently, everything is working fine (of course, I haven't tested it thoroughly).

The first step is creating the database as a service for Mongo on Azure

Go to the portal and click on New
Filter by "mongo"
Select Database as a service for MongoDB
Fill in your details for name, subscription, resource group and location

Create the required databases

Select the Resource you've just created. On the overview tab, you can only find the option to add collections. We don't need to create each of the collections, Sitecore will do it for use, but what we have to do is create the database.
Go to the "Browse" section. Now you will see the option to "create database" on the top of the new blade. Create 4 new databases:
  • Analytics
  • Tracking_live
  • Tracking_History
  • Tracking_contact

  • Add database to documentdb

Update the connection stringsGet the connection string from Azure

Select the connection string option, from the settings section. Then copy the connection string from the bottom of the new blade

DocumentDB connection string

Replace your connection strings

Open your connection string file: ...Website\App_Config\ConnectionStrings.config
Replace the connectionString for the connection analytics with the value you just copied from the portal. You will notice that this connection string is missing the database. To include the database, find the text "/?ssl=true" at the end of the string. We have to include the database after the "/". It should look like this: "xxxxxx/analytics?ssl=true";
Do the same for the other 3 databases.
Save the file.
Sitecore will re-start, but will throw errors like "Unable to connect to server Authentication failed because the remote party has closed the transport stream". This is because the mongo provider is not using configuring SSL correctly. We are lucky, Sitecore gives us the opportunity to set up the driver, before it uses it.

Set up Mongo Provider to use SSL "properly"

You can follow these two links to implement your own solution or you can use mine from here.
Just drop this dll in the bin folder, and this config file in the app_settings/include folder
That's it. Now your Sitecore will connect to DocumentDB and will start creating the required collections.
DocumentDB with support for mongo is still in preview, and this provider is not supported by Sitecore, so You shouldn't use it for production environments but if you are "playing" with Sitecore on Azure and you want to keep everything in Azure as Sitecore is doing with 8.2.1 supporting Azure webapps, Azure search, Azure Redis cache, etc. with this trick, you can now use DocumentDB to store your collection database.

Please get in touch with us if you find any errors using DocumentDB.


Add your comment





intranet Modern SharePoint teamwork employee engagement digital workspace SharePoint JavaScript Windows Azure Digital Transformation staff satisfaction productivity Microsoft Teams Office 365 Yammer cms content management system agile GDPR Microsoft Graph collaboration Microsoft sharepoint 2016 upgrade migration SharePoint Online 2016 Tech Trends Digital Disruption Context marketing marketing SharePoint 2010 SharePoint 2013 TFS Git security kentico Analytics jquery QA Quality Assurance testing content management websites Sitecore sitecore marketplace sitecore module cloud Microsoft Cloud Storage digital strategy technical consulting sitecore modules Experience database Sitecore 7 Sitecore 8 support account management customer experience Data Storage cms integration front end front end development prototype Cloud Storage StorSimple Front-end Development Layout SharePoint 2013 colour palette UI design website design log viewer sitecore cms website Azure big data business-critical sharepoint accessibility android apple chrome clear people clearpeople debug emulator ios mobile testing opera resize adobe desktop flash ie10 internet explorer 10 metro windows 8 bcsp Advanced System Reporter reporting framework ControlMode form control master page placeholder publishing console SharePoint 2007 SharePoint error search search results search values software testing testing scenario audit content information architecture retention schedules PowerShell QuickLaunch scripts SharePoint server 2010 business solutions metalogix replication replicator storagepoint stena technet UK Technet picture library slideshow web part RTM released to manufacturing caml caml query MOSS 2007 query infopath