Azure DevOps - How to deploy one build to 500 targets?

I have 500 databases that all need to get the build applied during a release...

I can't figure out using the Release task to loop through and deploy to all the databases.
Tagged:

Answers

  • danielpottengerdanielpottenger Cambridge, UK Posts: 7 Bronze 1
    edited August 27, 2020 10:48AM
    Hey Chris,

    The best way would likely be to define your own YAML pipeline, which may be the easiest way to do what you need.

    With Azure pipelines, you can define a YAML file that can loop over a set of parameters and feed those in to a specific task.

    As an example, I've defined a release task, deploy-from-package.yaml.

    You can set up multiple different parameters and feed them in, if the server, and authentication method changes, though it may be more complex.

    To use the above task, you need to define your own pipeline using YAML.

    When creating your pipeline, you have the option to use YAML, at which point you can write something similar to the above (if you need help writing the YAML for some of the build steps, you can create it using our tasks within Azure, and then use the View YAML button within Azure DevOps, and then copy and paste it across).



    It isn't ideal to keep your username and password within the YAML, for obvious reasons, but you should be able to use service connections to specify the same thing, which should help to obfuscate the credentials.

    From the above, you can see that my pipeline creates the following on run:



    Hope this helps!

    Dan
  • Kendra_LittleKendra_Little Posts: 139 Gold 3
    edited September 4, 2020 8:10AM
    Hi, quick update--- @danielpottenger was kind enough to do a  video explaining this as well, it's here:



    Below the video are the same links embedded in the written answer above (just to clarify that they aren't different info / you only need to look at them from one place).

    Thanks Dan!

    Edit: corrected the link :)
  • pfiorellapfiorella Posts: 3 New member
    Thanks for this, it looks promising. Is there a way to dynamically set the database parameter names instead of hard-coding them in the YAML?

    <table><tbody><tr><td>parameters:</td></tr><tr><td></td><td>    databases: <span>["database1","database2","database3","database4","database5"]</span></td></tr></tbody></table>
  • danielpottengerdanielpottenger Cambridge, UK Posts: 7 Bronze 1
    edited September 4, 2020 5:02PM
    Hey @pfiorella ,

    Yep, you can do that!

    As putting the code here is a little bit troublesome, I've added another YAML file to my GitHub repo.

    Now, when you create the pipeline, and run it, it'll allow you to specify the database array.


    Hope it helps,

    Dan
Sign In or Register to comment.