Azure DevOps中能否动态将发布预部署审批人设为发布提交者?
Great question! Let's walk through how to handle this for your Azure DevOps release pipeline setup.
Absolutely—this is totally achievable with Azure DevOps' built-in variables and approval configuration. Here's how to set it up:
- Navigate to your release pipeline's stage 2 configuration, and go to the Pre-deployment conditions section.
- Under Approvals, click "Add approver". Instead of selecting a static user or group, use the built-in release variable
$(Release.RequestedForId). - Save your changes. From now on, every time someone triggers a release, they'll automatically be assigned as the required approver for stage 2.
This variable pulls the unique ID of the user who initiated the release (whether manually or via an automated trigger like a CI build), so it's reliable and requires no extra scripting for basic use cases.
If for some reason reason the dynamic approver approach doesn't fit your workflow (e.g., you need more context in the pause prompt, or want additional control), here's a solid alternative:
- Add a Manual Intervention task at the start of stage 2. This task will immediately pause the release pipeline when it reaches stage 2.
- Configure the task to send a notification to
$(Release.RequestedForEmail)(another built-in variable targeting the submitter's email), and add a custom message like: "Please finish testing your changes, then click 'Resume' to trigger the test database cleanup." - Only the submitter (or users you explicitly grant permission) can resume the task, which will then proceed with the database destruction step.
This method gives you more flexibility—you can set timeouts, add detailed instructions, or even include links to test documentation directly in the intervention prompt.
For your specific goal (letting the release submitter sign off before cleaning up the test database), using $(Release.RequestedForId) for the pre-deployment approval is the simplest, most native solution. It integrates directly with Azure DevOps' approval system and requires minimal setup. If you want a more interactive pause experience, the Manual Intervention task is a great runner-up.
内容的提问来源于stack exchange,提问作者Mark Arnold




