Answers: <ol>
  <li>I use separate pipeline for each app</li>
  <li>you could use powershell task to restart IIS, but I dont think there is a way to do this without shutting down the website. You can also reconfigure website, so copy new code to location X, repoint website to location X, restart website. Then you can easily point it back if something fails and switch is almost instanteneous</li>
  <li>You can use library variable sets (or groups, dont remember). those can be tied to the stage in the release. it might also be possible to scope regular variables, but I've never tested that.</li>
  </ol>
  
Answers: CC BY-SA 4.0
Answers: 2019-09-13T19:52:08.800Z
Answers: To comment further here.  1) each pipeline represents a finished product. Lifecycle of each microservice should be independent thus will need a separate pipeline but that is rarely true unless you have true micro service architecture.  2) Web Deploy task uses MSDeploy.axd underneath; it will take the iis site down but gracefully (there is an outage page you can go to); true blue-green must be achieved with usage 2 web apps and some kind of load balancing device  3) you can tie a variable group to a specific stage and do not need a separate pipeline
Answers: Roman
Answers: CC BY-SA 4.0
Answers: 2020-01-06T17:46:22.297Z
Answers: What about when various apps have the same pipeline process? How can they be combined.... without cloning pipelines and changing every one when the process changes slightly? @Roman
Answers: AndrewRalon
Answers: CC BY-SA 4.0
Answers: 2020-01-06T17:53:51.863Z
Answers: you can use templates for that. so create a template and all the "identical" pipelines use the template. and then when you need to change the process - you change the central template
Answers: 4c74356b41
Answers: CC BY-SA 4.0
Answers: 2020-01-06T19:07:12.580Z
Answers: @4c74356b41 Custom stage templates have issues.... 1) They're only available within that project's Release. [link](https://stackoverflow.com/questions/59617411/deploy-many-apps-through-one-release-process-via-azure-devops) 2) To use them in other Releases, you'd have to export and import it to each Release. [link](https://stackoverflow.com/questions/59617411/deploy-many-apps-through-one-release-process-via-azure-devops) #3) They can't be updated. [link](https://docs.microsoft.com/en-us/azure/devops/pipelines/release/env-templates?view=azure-devops#how-do-i-update-a-custom-stage-template)
Answers: AndrewRalon
Answers: CC BY-SA 4.0
Answers: 2020-01-07T05:18:19.313Z
Answers: I have no idea what is a custom stage template. regular yaml templates do not have those issues
Answers: 4c74356b41
Answers: CC BY-SA 4.0
Answers: 2020-01-07T14:08:50.637Z
Answers: @4c74356b41 Yes, yaml templates would help. But then you lose all the visibility and convenience of the Azure Release portal UI.... Example: How would you deploy a release to a specific environment if everything is in the pipeline yaml?
Answers: AndrewRalon
Answers: CC BY-SA 4.0
Answers: 2019-02-07T15:13:20.060Z
Answers: 2019-02-07T15:13:20.060Z
Answers: 4c74356b41
Answers: <ol>
  <li><p>Depends on whether or not these small APIs change together or separately (meaning you may have code changes for only 1 API and be able to deploy it distinctly vs. deploy it all together).  If you may have distinct deploy needs, set up separate pipelines.</p></li>
  <li><p>There are extensions specifically for <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/iis-web-app-deployment-on-machine-group?view=azure-devops" rel="nofollow noreferrer">deploying IIS applications</a> that give you all of the features necessary to properly deploy these sites and <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/iis-web-app-management-on-machine-group?view=azure-devops" rel="nofollow noreferrer">control other aspects of IIS</a>.</p></li>
  <li><p>There are plenty of <a href="https://marketplace.visualstudio.com/search?target=AzureDevOps&amp;category=Azure%20Pipelines&amp;sortBy=Downloads" rel="nofollow noreferrer">extensions</a> and built-in features for transforming configuration files or modifying them using variables from within your pipeline.  In addition, each environment can have specific variables so that you can configure the same named variable, but change its value per environment.</p></li>
  </ol>
  
Answers: CC BY-SA 4.0
Answers: 2019-03-28T15:46:18.780Z
Answers: 2019-03-28T15:46:18.780Z
Answers: Sumo
Body: <p>Wanting to deploy a collection of .NET Core API's (microservices) using Azure DevOps I run into some challenges:</p>
  
  <ol>
  <li><p>Having 10+ small API's, how should I setup the Release Pipeline? One pipeline with one "stage" for each API/application? Or a separate Pipeline for each API?</p></li>
  <li><p>The API's are deployed to IIS on Windows Server. I'm using the FTP Task now but it's really cumbersome as the AppPool needs to be stopped, then the code is copied over, then the AppPool is started again. I know (non-disruptive) deployment on Azure with App Service is way easier with deployment slots, etc. but what tools can I use on a plain VPS with IIS on Windows Server?</p></li>
  <li><p>How can I transform or inject the correct <code>appsettings.json</code> values for each environment during Release using Azure DevOps? I could use Pipeline variables but they seem to be shared across the whole Pipeline, so I would need a separate Pipeline for each API then (see question 1). There's the task "<a href="https://marketplace.visualstudio.com/items?itemName=sergeyzwezdin.magic-chunks" rel="nofollow noreferrer">Magic Chunks</a>" but it doesn't handle arrays well (which is widely used for Serilog for example). Environment variables on the target machine would be an option, but the API's are deployed to IIS so how can I separate the environment variables per API (there could be the same keys with different values for multiple API's)?</p></li>
  </ol>
  
Tags: <azure-devops><azure-pipelines>
Title: How to setup Azure DevOps Pipelines and Releases with multiple apps
UserDisplayName: robog40796
ThreadText: # How to setup Azure DevOps Pipelines and Releases with multiple apps
  
  (Asked by: username_0 on 2019-02-07)
  
  Wanting to deploy a collection of .NET Core API's (microservices) using Azure DevOps I run into some challenges:
  
  1. Having 10+ small API's, how should I setup the Release Pipeline? One pipeline with one "stage" for each API/application? Or a separate Pipeline for each API?
  2. The API's are deployed to IIS on Windows Server. I'm using the FTP Task now but it's really cumbersome as the AppPool needs to be stopped, then the code is copied over, then the AppPool is started again. I know (non-disruptive) deployment on Azure with App Service is way easier with deployment slots, etc. but what tools can I use on a plain VPS with IIS on Windows Server?
  3. How can I transform or inject the correct `appsettings.json` values for each environment during Release using Azure DevOps? I could use Pipeline variables but they seem to be shared across the whole Pipeline, so I would need a separate Pipeline for each API then (see question 1). There's the task "[Magic Chunks](https://marketplace.visualstudio.com/items?itemName=sergeyzwezdin.magic-chunks)" but it doesn't handle arrays well (which is widely used for Serilog for example). Environment variables on the target machine would be an option, but the API's are deployed to IIS so how can I separate the environment variables per API (there could be the same keys with different values for multiple API's)?
  
  **Tags:** azure-devops, azure-pipelines
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-02-07. Score: 2
  
  1. I use separate pipeline for each app
  2. you could use powershell task to restart IIS, but I dont think there is a way to do this without shutting down the website. You can also reconfigure website, so copy new code to location X, repoint website to location X, restart website. Then you can easily point it back if something fails and switch is almost instanteneous
  3. You can use library variable sets (or groups, dont remember). those can be tied to the stage in the release. it might also be possible to scope regular variables, but I've never tested that.
  
  > **Comments:**
  > **username_2**: To comment further here.  1) each pipeline represents a finished product. Lifecycle of each microservice should be independent thus will need a separate pipeline but that is rarely true unless you have true micro service architecture.  2) Web Deploy task uses MSDeploy.axd underneath; it will take the iis site down but gracefully (there is an outage page you can go to); true blue-green must be achieved with usage 2 web apps and some kind of load balancing device  3) you can tie a variable group to a specific stage and do not need a separate pipeline  
  > **username_3**: What about when various apps have the same pipeline process? How can they be combined.... without cloning pipelines and changing every one when the process changes slightly? @username_2  
  > **username_1**: you can use templates for that. so create a template and all the "identical" pipelines use the template. and then when you need to change the process - you change the central template  
  > **username_3**: @username_1 Custom stage templates have issues.... 1) They're only available within that project's Release. [link](https://stackoverflow.com/questions/59617411/deploy-many-apps-through-one-release-process-via-azure-devops) 2) To use them in other Releases, you'd have to export and import it to each Release. [link](https://stackoverflow.com/questions/59617411/deploy-many-apps-through-one-release-process-via-azure-devops) #3) They can't be updated. [link](https://docs.microsoft.com/en-us/azure/devops/pipelines/release/env-templates?view=azure-devops#how-do-i-update-a-custom-stage-template)  
  > **username_1**: I have no idea what is a custom stage template. regular yaml templates do not have those issues  
  > **username_3**: @username_1 Yes, yaml templates would help. But then you lose all the visibility and convenience of the Azure Release portal UI.... Example: How would you deploy a release to a specific environment if everything is in the pipeline yaml?  
  
  ---
  
  ### Answer by username_4 on 2019-03-28. Score: 0
  
  1. Depends on whether or not these small APIs change together or separately (meaning you may have code changes for only 1 API and be able to deploy it distinctly vs. deploy it all together). If you may have distinct deploy needs, set up separate pipelines.
  2. There are extensions specifically for [deploying IIS applications](https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/iis-web-app-deployment-on-machine-group?view=azure-devops) that give you all of the features necessary to properly deploy these sites and [control other aspects of IIS](https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/iis-web-app-management-on-machine-group?view=azure-devops).
  3. There are plenty of [extensions](https://marketplace.visualstudio.com/search?target=AzureDevOps&category=Azure%20Pipelines&sortBy=Downloads) and built-in features for transforming configuration files or modifying them using variables from within your pipeline. In addition, each environment can have specific variables so that you can configure the same named variable, but change its value per environment.
  
  
  ---
  
  