It seems that deploying ARM Templates that contain JSON comments isn't working. There are 2 parts to this:
Part 1: .jsonc files
When trying to deploy a ARM Template with a .jsonc extension, I get error: Unsupported template file type: <file-path>
Seems to be caused by this line:
|
if (templateFile && path.extname(templateFile).toLowerCase() !== ".json") { |
|
throw new Error(errorMessages.unsupportedTemplateFile(templateFile)); |
|
} |
Presumably here too:
|
path.extname(parametersFile).toLowerCase() !== ".json" |
|
) { |
|
throw new Error(errorMessages.unsupportedParametersFile(parametersFile)); |
Part 2: Comments in ARM Template JSON
When trying to deploy a ARM Template with inline comments, I get error: Expected double-quoted property name in JSON at position 9230 (line 240 column 36).
Per MS Docs, comments in ARM Templates are supported: https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/syntax#comments
I believe it's that the JSON.parse doesn't support comments...
|
const parametersContents = parameters ? JSON.parse(parameters) : undefined; |
|
const templateContents = template ? JSON.parse(template) : undefined; |
Unfortunately, that's as far as my understanding goes.
It seems that deploying ARM Templates that contain JSON comments isn't working. There are 2 parts to this:
Part 1:
.jsoncfilesWhen trying to deploy a ARM Template with a
.jsoncextension, I get error:Unsupported template file type: <file-path>Seems to be caused by this line:
bicep-deploy/packages/bicep-deploy-common/src/file.ts
Lines 190 to 192 in 132ee40
Presumably here too:
bicep-deploy/packages/bicep-deploy-common/src/file.ts
Lines 171 to 173 in 132ee40
Part 2: Comments in ARM Template JSON
When trying to deploy a ARM Template with inline comments, I get error:
Expected double-quoted property name in JSON at position 9230 (line 240 column 36).Per MS Docs, comments in ARM Templates are supported: https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/syntax#comments
I believe it's that the
JSON.parsedoesn't support comments...bicep-deploy/packages/bicep-deploy-common/src/file.ts
Lines 210 to 211 in 132ee40
Unfortunately, that's as far as my understanding goes.