Environment name binding is compile-time only in Azure DevOps YAML
0 reputation · 25 Oct 2021, 08:03 UTC
A repeatable development environment is needed where each branch maps to a pre-created Azure DevOps Environment with approval gates and per-environment variable groups. The goal is to keep a single pipeline definition that can target different environments without manual edits.
Azure DevOps Environments must exist before a deployment job runs and are referenced by name in the environment keyword. The name is project-global and the deployment history is tied to that environment. Variable scoping is available via environment-scoped variable groups, and approvals can be configured on the environment.
The documented templating behavior for the environment reference is unclear for dynamic mapping. It is known that runtime variables are not accepted for the environment name, while compile-time template expressions are allowed.
Can an environment name be resolved from a runtime variable or queue-time parameter? Is there a supported pattern to map dynamic branch names to pre-created environments without duplicating pipeline definitions? What are the limits on templating environment references for repeatable dev environments?