Problem:
In developing ARM templates using Bicep, there is a difference in the way you escape quotes for values that have spaces. For instance, when specifying a “commandToExecute” on a Custom Script Extension, often times you’ll need to pass in a value that has a space in it. Using string interpolation in Bicep, you pass in that value but you’ll have to wrap it in escaped quotes to ensure the value is handled properly.
Solution:
To resolve this issue, ensure all escaped double quotes, \”, within a string are replaced with an escaped single quote, \’. When your Bicep file is transpiled in JSON, the escaped single quote will resolve to a single quote. The single quotes wrapping your string are converted to double quotes.
Explanation:
The last few days I’ve been converting my Azure Virtual Desktop solution over to Bicep. In the process of that conversion, I realized my double quotes were throwing errors. Yes, I used Bicep CLI and decompiled my JSON files. I searched high and low for the solution but in the end I had to dig through Microsoft Docs to find the answer. In the “String” section of the Data Types reference page, this is broken and explains it well enough. I’m writing this blog post so anyone else struggling to find the answer will waste less time finding it.