Home > Blockchain >  AzureResourceManagerTemplateDeployment fail in Azure DevOps pipeline
AzureResourceManagerTemplateDeployment fail in Azure DevOps pipeline

Time:08-10

I have the following task that runs an Arm Template that is tested and working in another system for creating a Management group in Azure. Everything is checked and it should work, but I keep giving this error:

##[error]Check out the troubleshooting guide to see if your issue is addressed: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-resource-group-deployment?view=azure-devops#troubleshooting
##[error]Error: Could not find any file matching the template file pattern

What I am doing wrong?

parameters:
  - name: ParentId
    type: string
  - name: NameId
    type: string
  - name: DisplayName
    type: string

steps:
- task: AzureResourceManagerTemplateDeployment@3
  inputs:
    deploymentScope: "Management Group"
    azureResourceManagerConnection: ServiceConnectionName
    location: "West Europe"
    csmFile: "$(System.DefaultWorkingDirectory)/**/ManagementGroup.json"
    csmParametersFile: "$(System.DefaultWorkingDirectory)/**/ManagementGroup.parameters.json"
    overrideParameters: "-NameId ${{ parameters.NameId }} -DisplayName ${{ parameters.DisplayName }} -ParentId ${{ parameters.ParentId }}"
    deploymentMode: "Incremental"
    deploymentOutputs: armOutputs

CodePudding user response:

I have had recently similar issue. I have noticed you are using capital letters for naming your arm template. As far as I know it should be small letters. So to solve this particular issue, you need to correct following lines:

csmFile: "$(System.DefaultWorkingDirectory)/**/ManagementGroup.json"
csmParametersFile: "$(System.DefaultWorkingDirectory)/**/ManagementGroup.parameters.json"

to

csmFile: "$(System.DefaultWorkingDirectory)/**/managementgroup.json"
csmParametersFile: "$(System.DefaultWorkingDirectory)/**/managementmroup.parameters.json"

And make your files with small letters in your repository.

That should solve the problem.

  • Related