Recently, I been struck by an issue where my config patches were not reflecting in Test environment. Not to mention, it is working absolutely fine in my local as well as on CI(typical developer’s excuse).
After initial investigation found, it is patching all of the config changes from my custom config patch file but not the particular one where I was overriding the Sitecore’s OOTB logging functionality to log error and fatal to Azure Application Insight(know as AppInsight).
For our deploying artifacts to test environment(which is Azure PAAS), we are using another great tool by Sitecore called Sitecore Azure Module(currently known as Sitecore Azure Toolkit).This is the one which is compatible with Sitecore 8.1. With this in place, my whole focus is shifted to this tools functionality and internal processing.
After thorough investigation of this tool and it’s architecture, I found the root cause of the config not patching issue(or I say config patching overriding issue). The module’s configuration item of template type /sitecore/templates/Azure/Deployment/Azure Deployment has a field call Global WebConfig Patch which has title text as [Do not edit!] – Global Web Config Patch (These are the global web config patches that will always be applied to every deployment). This field holds all the configurations for Sitecore XP to work in Azure PAAS environment.
While we trigger the command to Upgrade Files in Sitecore Azure Module Window, it start packaging all the required files and also configurations. As part of Sitecore configuration packaging, it gets the whole patched output of all config files and after that is applies the config changes mentioned in the Global WebConfig Patch field of the above mentioned template under your Environment/location/Farm/WebRole item of your module configuration. The whole config path is finally written in single Sitecore.config file.
Tip: Be cautious while changing this global setting of Sitecore Azure module. Don’t do it until and unless you are knowing what are you doing.
Happy Deployment…!!!! 🙂