Reputation: 155
I'm working on an ARM template containing APIs of an API Management resource, that have been generated by Azure API Management DevOps Resource Kit.
The ARM template is more than 50,000 lines and when I try to deploy it, I get this error:
InvalidTemplate - Deployment template language expression evaluation failed: 'Unable to parse language expression ' ': expected token 'Identifier' and actual 'EndOfData'.'. Please see https://aka.ms/arm-template-expressions for usage details.
This error doesn't contains any information on the location of the error in my template and the file is too large to be debugged manually.
Is there a tool that could allow to debug an ARM Template with more precise information? (Especially that could gives the line on which the error occurs).
Upvotes: 2
Views: 2328
Reputation: 427
I found the tool provided by Microsoft itself very useful.
arm-ttk is a powershell script that checks your createUIDefinition.json
and your mainTemplate.json
.
The only downside is that it is bases on powershell and if you are on linux you first have to install pwsh
.
Alternatively you can use a docker container.
Upvotes: 1
Reputation: 1885
You can use the azure client to syntactically validate the template:
az group deployment validate
--resource-group <rg-name>
--template-file <arm-name>
or if you prefer PowerShell:
Test-AzureRmResourceGroupDeployment
-ResourceGroupName <rg-name>
-TemplateFile <arm-name>
Also, in VSCode (or other IDEs like Rider) you can download the ARM
plugin to easily spot errors like these.
Upvotes: 4
Reputation: 625
Try the extension for visual studio code: https://marketplace.visualstudio.com/items?itemName=msazurermtools.azurerm-vscode-tools
It will give you Intellisense for the ARM template and maybe then you will find the error.
Upvotes: 3