I'm just getting started with azure pipelines. We're wanting to move away from manually deploying our Azure resources with arm templates and parameter files to do doing so with a devops pipeline.
While it's straightforward to do this with a single template+parameter's json file, I cannot see a sensible way to do with with multiple files.
I've seen discussions concerning using an array as a parameter to a pipeline template - this would work, but I cannot see how to create the parameter array other than setting it manually in the pipeline yaml file.
A more useful solution would be either by reading its contents in from a text file- which we could generate before the file is read, or - even more ideally- by referencing a directory listing of the folder within the repo containing the json parameter files for the template that's common to them all.
A code fragment within the yaml pipeline is capable of passing back a single string variable E.g.
script: |
# Get list of files in folder
$fl = get-childitem ./templates | select-object -expand name
Write-output "##vso[task.setvariable variable=fl]$fl"
But all this produces is a single string which I cannot then split.
Similarly, I can use a fragment of code to dynamically create the file listing - but again, cannot see how to read that within the pipeline.
Is there an approach that lets my dynamically set the content of the parameter array within an devops pipeline, or read the array in from a file?
Or should i just give up and write the entire thing in a powershell script and use a task to run that instead of trying to use the azure deployment tasks in a devops?
Thanks Dave