Answers: <p>You can create a <strong>Release Pipeline</strong> with a stage for every environment; each stage has a different variable group, defining that environment's settings.<br />
  On each stage you can copy files, etc. and run tests against the environment.<br />
  If the test/stage succeeds, the pipeline goes ahead to the next stage.
  Between the stages, you can configure that an authorized person has to approve the next step.<br />
  The screenshot below is a release pipeline of one of my little side projects.</p>
  <p><a href="https://i.sstatic.net/W8nSt.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/W8nSt.png" alt="release pipeline with multiple stages" /></a></p>
  
Answers: CC BY-SA 4.0
Answers: 2019-11-14T04:09:59.377Z
Answers: Yup, this is the best answer!
Answers: Eriawan Kusumawardhono
Answers: CC BY-SA 4.0
Answers: 2019-11-14T17:25:39.523Z
Answers: This doesn't address the variable aspect of the question
Answers: xtreampb
Answers: CC BY-SA 4.0
Answers: 2019-11-13T12:50:21.050Z
Answers: 2021-12-19T08:39:43.527Z
Answers: 2021-12-19T08:39:43.527Z
Answers: Ned Flanders
Answers: <p>If I understand your question, you want a single variable to have different values per stage.  This same concept Octopus took a while to get right with being able to manage the variables.  Currently that isn't a thing that is available in Azure devops.  You can create a pipeline that Ned Flanders suggested but you would need to define the variable multiple times for each environment and scope each variable to the stage it is deployed in.  I think this is a need of azure devops and is one thing that octopus deploy does better than azure devops. I would recommend opening a feature request for this.  Microsoft moved away from user voice and onto developer community.  There is a request for this back in April that got closed in September due to low activity <a href="https://developercommunity.visualstudio.com/idea/552933/single-pipeline-variable-separate-values-per-stage.html" rel="nofollow noreferrer">closed request</a>.  If you open up a new one, I'm sure we can get people here to vote on it</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-11-13T14:07:30.223Z
Answers: 2019-11-13T14:07:30.223Z
Answers: xtreampb
Body: <p>I've configured first deployment pipeline to an on-prem DEV environment.
  The project consists of 3 identical environments, DEV, UAT and PROD
  While their setup is exactly alike, their config (database credentials etc.) is obviously not. </p>
  
  <p>I'm using the DevOps <code>variables</code> to alter <code>web.config</code> and <code>appsettings.json</code> configuration files while deploying. 
  Therefore I'd like to apply the same deployment pipeline, targeting 3 different environments with 3 different variables sets.</p>
  
  <p>This is the way I've seen in Octopus. Is it possible in the DevOps?</p>
  
Tags: <azure-devops><azure><azure-pipelines>
Title: Azure Devops, multiple on-prem environments, variables per environment
UserDisplayName: mikegolf
ThreadText: # Azure Devops, multiple on-prem environments, variables per environment
  
  (Asked by: username_0 on 2019-11-13)
  
  I've configured first deployment pipeline to an on-prem DEV environment.
  The project consists of 3 identical environments, DEV, UAT and PROD
  While their setup is exactly alike, their config (database credentials etc.) is obviously not.
  
  I'm using the DevOps `variables` to alter `web.config` and `appsettings.json` configuration files while deploying.
  Therefore I'd like to apply the same deployment pipeline, targeting 3 different environments with 3 different variables sets.
  
  This is the way I've seen in Octopus. Is it possible in the DevOps?
  
  **Tags:** azure-devops, azure, azure-pipelines
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-11-13. Score: 2
  
  You can create a **Release Pipeline** with a stage for every environment; each stage has a different variable group, defining that environment's settings.  
  On each stage you can copy files, etc. and run tests against the environment.  
  If the test/stage succeeds, the pipeline goes ahead to the next stage.
  Between the stages, you can configure that an authorized person has to approve the next step.  
  The screenshot below is a release pipeline of one of my little side projects.
  
  [![release pipeline with multiple stages](https://i.sstatic.net/W8nSt.png)](https://i.sstatic.net/W8nSt.png)
  
  > **Comments:**
  > **username_2**: Yup, this is the best answer!  
  > **username_3**: This doesn't address the variable aspect of the question  
  
  ---
  
  ### Answer by username_3 on 2019-11-13. Score: 1
  
  If I understand your question, you want a single variable to have different values per stage. This same concept Octopus took a while to get right with being able to manage the variables. Currently that isn't a thing that is available in Azure devops. You can create a pipeline that username_1 suggested but you would need to define the variable multiple times for each environment and scope each variable to the stage it is deployed in. I think this is a need of azure devops and is one thing that octopus deploy does better than azure devops. I would recommend opening a feature request for this. Microsoft moved away from user voice and onto developer community. There is a request for this back in April that got closed in September due to low activity [closed request](https://developercommunity.visualstudio.com/idea/552933/single-pipeline-variable-separate-values-per-stage.html). If you open up a new one, I'm sure we can get people here to vote on it
  
  
  ---
  
  