0
votes

We are trying to set up an infrastructure pipeline in Azure DevOps and we have a requirement to have several variables set with each infra build, which will be defined by the project. This also involves copying VMs from one location to another and renaming etc. I can do this through Powershell, however I'm struggling on how to import all the variables for each infra build. Since there are a few I was thinking I could use an Excel file (csv) and then do a foreach loop, that way the code is consistent and simpler.

Is there a way to have a CSV uploaded to Azure DevOps that triggers the powershell pipeline to run or is there even a way I can add a CSV to a pipeline, I can always look at another trigger once the CSV has been uploaded?

There are 7 fields (columns) in each infra build and there could be up to 30-50 builds (rows) running at each time hence the desire to automate it and use a CSV, adding variables each time is just not practical.

Thanks in advance and hope that makes snese

Thanks

1

1 Answers

1
votes

Is there a way to have a CSV uploaded to Azure DevOps that triggers the powershell pipeline to run or is there even a way I can add a CSV to a pipeline, I can always look at another trigger once the CSV has been uploaded?

From this doc, the * can only set as the final character.

So, you can create a folder named 'csv' to upload the '.csv' file, then set your yml file like this:

trigger:
  branches:
    include:
    - main
  paths:
    include:
    - 'csv/*'