8
votes

I am trying to deploy an Azure ARM script in VSTS Pipeline.

I "Published" the Artifacts in the Build Step and Downloaded the Artifacts in the Release Step. The Log seems to indicate that it found the ARM script (After much trial and error. The prescribed manner found here does not seem to work at all).

I however get Error: Could not find any file matching the template file pattern

Incidentally, I get this error even if can't find the file (which makes sense..but not when it actually does find the file). The ARM script deploys correctly when I deploy manually in Azure Portal.

I am using the Azure Resource Group Deployment step in the release pipeline.

I'm not sure what other information might help troubleshoot this, but request and hopefully I can get it to you.

Thanks

2018-12-14T18:32:06.6009951Z ##[section]Starting: Azure Deployment:Create Or Update Resource Group action on ChrisGroup
2018-12-14T18:32:06.6015952Z 

==============================================================================
2018-12-14T18:32:06.6016124Z Task         : Azure Resource Group 
Deployment
2018-12-14T18:32:06.6016287Z Description  : Deploy an Azure resource manager (ARM) template to a resource group. You can also start, stop, delete, deallocate all Virtual Machines (VM) in a resource group
2018-12-14T18:32:06.6016444Z Version      : 2.141.4
2018-12-14T18:32:06.6016526Z Author       : Microsoft Corporation
2018-12-14T18:32:06.6016655Z Help         : [More Information] (https://aka.ms/argtaskreadme)
2018-12-14T18:32:06.6016801Z 
==============================================================================
2018-12-14T18:32:06.9610677Z Checking if the following resource group exists: ChrisGroup.
2018-12-14T18:32:07.2734470Z Resource group exists: true.
2018-12-14T18:32:07.2736899Z Creating deployment parameters.
2018-12-14T18:32:07.2809876Z The detected encoding for file 'D:\a\r1\a\IAC\ARM.json' is 'utf-8'
2018-12-14T18:32:07.3021166Z ##[error]Error: Could not find any file matching the template file pattern
2018-12-14T18:32:07.3030720Z ##[section]Finishing: Azure Deployment:Create Or Update Resource Group action on ChrisGroup

As per request:

In the Template Parameters field I put -dailyreports_name '$(IACWeb)' -dailyreportsapi_name '$(IACAPI)'

and OMG... It's supposed to be a path to a variables file. UGH

Once I put into the Override Template Parameters, it works.

Microsoft should probable reword the label to "Template Parameters File"

3
What values are you providing to the step?Daniel Mann
Thanks for the jog to the brain. I completely didn't expect it to be anything other than the path to the template file. The error message was quite misleading.Chris ten Den

3 Answers

10
votes

You need to put the parameters being passed in into the "Override template parameters". The "Template parameters" field is actually a reference to a file location.

0
votes

##[error]Error: Could not find any file matching the template file pattern

Check few things here :

  1. check all parameter names (case sensitive) in the parameter file and template file.

  2. if you are using yml file for azure devops pipeline,

    check all overrideParameters are correctly mentioned overrideParameters: '-environment "${{parameters.environment}}"' #for example

    check csmParametersFile , csmFile path in the yml

0
votes

For me, the issue turned out to be that I had to select specific build number while creating the release. If don't use specific build and just leave latest version option by default, then this error comes.