0

We have our ARM templates in a build folder alongside our code. In our pipeline we publish our build folder as an artefact. We have master templates.

We want to run our ARM templates from a Release Pipeline, however our master templates can't find our linked templates, we get the following errors:

##[error]InvalidTemplateSpec: The relative path 'arm-kv/1.0.0.0/azuredeploy.json' could not be resolved. Please ensure the parent deployment references either an external URI or a template spec ID. The relativePath property cannot be used when creating a template deployment with a local file.

The folder structure of the created artefact is as follows;

Builds/
+-- ARM/
     +-- parameters/
     |   +-- azuredeploy-rg-parameters.json  ## parameters file
     |
     +-- arm-kv
     |   +-- 1.0.0.0/
     |       +-- azuredeploy.json   ##(linked key vault template)
     |
     |- arm-storage
     |   +-- 1.0.0.0/
     |       +-- azuredeploy.json   ##(linked storage template)
     |
     +-- azuredeploy-rg.json   ##(main template)

What is the correct syntax for referencing the subfolder/templates? We've tried

  • arm-kv/1.0.0.0/azuredeploy.json (relative path)
  • ./arm-kv/1.0.0.0/azuredeploy.json
  • /builds/arm/arm-kv/1.0.0.0/azuredeploy.json (the full artefact path)
Mark Cooper
  • 6,738
  • 5
  • 54
  • 92

1 Answers1

0

When you run the task you are probably in the $(System.DefaultWorkingDirectory) context. This is the folder where artifacts are downloaded. Please check what you have exacelty there by adding a step and listing files.

Once you have it change your working directory for your ARM deployment step to $(System.DefaultWorkingDirectory)/builds/arm (it could be slightly different and this is why former step is needed to verify the path). Once you set it correctly you will get azuredeploy-rg.json in the root and all linked templates will become discoverable.

Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107