4

I was changing an ARM template (including linked templates) that was working for months. After building successfully, when deploying I got the error

New-AzureRmResourceGroupDeployment : A parameter cannot be found that matches parameter name '_artifactsLocationSasToken'
Kai Walter
  • 3,485
  • 2
  • 32
  • 62

2 Answers2

9

I knew that uploading artifacts sometimes is a somewhat sensitive business, so I checked out corresponding posts to get hints - among them this one that seemed helpful. But nothing had an effect, so I took a break.

After coming back I thoroughly checked my template and

  1. found one right parenthesis too much in a medium complex concat/parameter/variable expression (highlighted with a 1 character wide squiggly line)
  2. found that I missed closing curly braces and square brackets at another place (after applying a "Format Document" on the template)

Hence my take on that: do not rely on the Build process; don't get misled by the error message; when having this kind of error re-check the template, even shrink it down to isolate invalid areas

Kai Walter
  • 3,485
  • 2
  • 32
  • 62
  • 1
    Thank you for this. For me, it was a missing comma between the properties and resources sections for a web app definition in the template. There were no warnings, red squiggles or similar, just this error. – RasmusW Apr 17 '18 at 18:38
  • Fascinating - revisiting my own answer because I had this problem again after a long while. Somehow lost the closing ] in a "resources": [...] section. – Kai Walter Jul 06 '18 at 18:27
  • Is there a way to sort all the properties in the template in one go ? – HariHaran Nov 07 '18 at 05:33
  • 1
    @HariHaran - sorry, cannot help you with that – Kai Walter Nov 07 '18 at 15:36
  • @KaiWalter check this out , i made a feature request to vs https://developercommunity.visualstudio.com/idea/377248/sort-properties-in-arm-template-in-whole-file.html – HariHaran Nov 08 '18 at 04:17
  • 1
    @HariHaran - yeah, would absolutely make sense and life easier - I voted for it – Kai Walter Nov 08 '18 at 07:37
3

In my case, the error was caused by an invalid template path (parameter -TemplateFile). I had defined another parameter in the template file, but since the deployment command could not find the template itself, it could also not find the value for my user-defined parameter inside the template.

It seems that this error is a generic message invoked by Powershell, if the supplied parameter is empty. It would be nice the New-AzureRmResourceGroupDeployment command would perform some validation of the parameters, like checking if the template file exists and if the format of the template file is valid... These generic PS error messages are not very helpful.

Lazer
  • 501
  • 4
  • 14