This will be a very short post, but it’s something that drove me crazy while adding OMS deployment and configuration to my automated deployment and configuration of our internal application and underlying infrastructure using PowerShell, PowerShell DSC and ARM templates. As a part of this deployment, I wanted to include saved queries which are required to create alerts, but I was unable to figure out how to escape the double quotes needed in OMS search for queries such as the following:
As you can see, JSON does not like double quotes within double quotes, which makes sense. The question is how do we escape the double quotes? After a bit of research I was able to track down a sample template and find the answer. Simply add a back-slash before each double quote and the issue is solved! See below for an example.
Hopefully this will save somebody a bit of time in the future as we inevitably move towards increased automation!