11

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"

riQQ
  • 9,878
  • 7
  • 49
  • 66
Chris ten Den
  • 549
  • 1
  • 5
  • 19

4 Answers4

13

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.

Chris ten Den
  • 549
  • 1
  • 5
  • 19
  • I am currently running into the same issue as you are, but I am not able to resolve it. It used to work, but I added some .sql files to my application and now it suddenly throws the error "could not find any files", what exactly do you mean by "override template parameters" – Jean-Paul Mar 19 '19 at 14:47
  • It's one of the fields in the Azure Resource Group Deployment task. – Dan Friedman Mar 30 '19 at 17:58
0

##[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

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.

Naresh Nagpal
  • 299
  • 4
  • 6
0

When migrating from Classic to YAML deployments:

Seeing:

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

may be because you're referencing Pipeline Artifacts through the inputs csmFile and csmParametersFile, without actually having access to them in your pipelines stage. You may need to download the artifacts first, as seen in the second stage in this answer.

A quick check to see if this is the case would be to by-pass your artifacts, and point the mentioned inputs directly to your azuredeploy.json and azuredeploy.parameters.json files where they are located in your repo.