How to escape double quotes in ARM templates

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!




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s