Sitecore Azure module incorrectly patches the IDTable section in configuration file


Description

When performing a regular deployment to a Delivery Farm using the Sitecore Azure module 2.0 or later version, the module incorrectly patches the IDTable section in the configuration file. As a result, Sitecore may sometimes throw the "Could not create instance of type: Sitecore.Data.SqlServer.SqlServerIDTable. No matching constructor was found." error in Azure environment.

An example of the exception and its stack trace:

ERROR Exception in alarm clock event subscriber.
Exception: Sitecore.Exceptions.ConfigurationException
Message: Could not create instance of type: Sitecore.Data.SqlServer.SqlServerIDTable. No matching constructor was found.
Source: Sitecore.Kernel
   at Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)
   at Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper)
   at Sitecore.Configuration.Factory.CreateObject(String configPath, String[] parameters, Boolean assert)
   at Sitecore.Data.IDTables.IDTable.GetKeys(String prefix)
   at Sitecore.ListManagement.ContentSearch.Pipelines.Locking.GetLockedLists.GetLockedLists.Process(GetLockedListsArgs args)
   at (Object , Object[] )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.ListManagement.ContentSearch.PipelineBasedContactListStore`2.GetLockedListIds()
   at Sitecore.ListManagement.ListManager`2.GetLockedLists()
   at Sitecore.ListManagement.Analytics.UnlockContactListsAgent.Execute()
   at Sitecore.Services.AlarmClock.Heartbeat_Beat(Object sender, EventArgs e)
‌ERROR Scheduling.WebDAVOptionsCleanupAgent: Exception occurred. Exception details:Sitecore.Exceptions.ConfigurationException: Could not create instance of type: Sitecore.Data.SqlServer.SqlServerIDTable. No matching constructor was found.
   at Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)
   at Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper)
   at Sitecore.Configuration.Factory.CreateObject(String configPath, String[] parameters, Boolean assert)
   at Sitecore.Configuration.IDTableWebDAVOptionStore.GetOptionIDs()
   at Sitecore.Configuration.IDTableWebDAVOptionStore.GetExpiredOptions(TimeSpan expirationSpan)
   at Sitecore.Tasks.WebDAVOptionsCleanupAgent.CleanupWebDAVOptions()
   at Sitecore.Tasks.WebDAVOptionsCleanupAgent.Run()

Solution

Perform the following steps to resolve the issue:

  1. In the /sitecore/system/Modules/Azure/<Environment>/<Location>/<Farm>/Role01/<AzureDeployment> item, modify the Deployment Type Web Config Patch field value as shown below:
    <xsl:template match="sitecore/IDTable/param[@connectionStringName='master']/@connectionStringName">
     <xsl:attribute name="connectionStringName">web</xsl:attribute>
    </xsl:template>
  2. In the /sitecore/templates/Branches/Azure/Azure Cd Deployment/Deployment Cd item, modify the Deployment Type Web Config Patch field value in the same way.
  3. In Sitecore Azure application, run the Upgrade Files operation against the existing deployment.