Sitecore Azure and the analytics database

Recently I was given the opportunity to release a site on to Azure.  Overall I found the experience to be very pleasant.  Once the install is in place, environment file, certificate, and the proper Azure MSI installs (in the documentation) are on your source server, the tool is fairly straight forward.  Any author should be able to handle releases and updates with the out of box options.  DMS is supported in version 3.0+, but I found some extra tasks are required that might not be as obvious to centralize your analytics database. By default.  When you add a new Delivery Farm, the Sitecore Azure tool will spin up a core, web, and analytics database specifically for that role.  Create another farm in another location and that will create another set of databases as well.  In general having the core and web database separated out isn't a huge deal, but having a bunch of different analytic databases is a DMS marketers worst nightmare!  You need one centralized analytic database. Before we centralize, lets take an example scenario.  Your CM (Content Management) server is local and is acting as the source server where Sitecore Azure is installed and manages your Azure environment.  Then we created a Delivery Farm (CD - Content Delivery) US - West and US - East.  At this point we have a local analytics database and one at our west coast and east coast location. At this point you need to define where your primary analytic database will be located.  It could be your local server database assuming the proper connection can be maintained.  Alternatively you can pick one location on Azure.  We have selected the US - West location. Here are the steps to updating.

  1. Find your analytic connection string.  All of the Azure Web Roles are found under - /sitecore/system/Modules/Azure .  The naming convention from this point goes Azure Environment, Location, Delivery or Editing, Role, and Production or Staging.  In the last item or in our case: /sitecore/system/Modules/Azure/<Azure Environment>/West US/Delivery01/Role01/Production you will find the field "Connection String Patch".  Inside here you will find the analytics connection string.
  2. Test on your CM.  Since CM changes have the least amount of impact on your visitors, test out the connection string here first.  On your local server open /App_Config/ConnectionStrings.config and swap out the analytic connection string.  Test your reports, test front end if available.
  3. Update your other web roles.  The same way you found your analytic connection string on the west coast, you will update the "Connection String Patch" on the east coast by following the item path:  /sitecore/system/Modules/Azure/<Azure Environment>/East US/Delivery01/Role01/Production
  4. Cleanup.  Update your east coast web role to reflect your intent.  There are two steps.  First under /sitecore/system/Modules/Azure/<Azure Environment>/East US/Delivery01/Role01/Production/Database References/analytics, point the "Database Id" field at the west coast database.  Second, delete the analytics database item found under -  /sitecore/system/Modules/Azure/<Azure Environment>/East US/Delivery01/Sql01/Set01
  5. Release changes and test.  Back in the azure tool, select the east coast location and "Upgrade Files".  After a few minutes your Azure updates will be complete and you can test your site.  In the case you are using the Traffic Manager to split traffic between locations (which you probably are in this case), you can go directly to this site instance by selecting the "Browse" option in the Sitecore Azure tool location menu option.

Finally as extra credit, and maybe a bit of piece of mind that you really did point everything to the right place, you can login to the Windows Azure portal and delete the analytic databases you are not using.   Then test each instance of your site to make sure no ugly analytic errors pop up. I hope this was helpful.  I have been watching the Sitecore Azure tool progress over the last year, and just like any Sitecore tool, each version that comes out is better than the last.  If you have been holding off trying Azure, 3.0 for Sitecore 6 or 3.1 Sitecore 7 is a great place to start.  The tool itself is very simple to use and the ability to use DMS now makes it a valid option.