Pipeline variables
What it is
Pipeline variables are named, typed values that you inject into a CI job/stage at runtime — rather than hard-coding a value into the pipeline YAML or the script. Azure Pipelines scopes them (pipeline, runtime, project) with $(var) syntax; GitHub Actions maps them via env:/with: and ${{ }}.
Why it exists
To make one pipeline definition reusable across environments (dev/test/prod), branches, and compilations without editing the YAML itself. Variables turn a fixed script into a parameterized, env-aware performer — the same logic, different inputs.
Key ideas
- Scope/precedence: runtime (inline/API) > pipeline/subscription > project/env, mirroring how
env:in GitHub builds on the workflow+dependency store. - Typing:
string,bool,secret,number; YAMLvariables:defaults +secrets.store references. - Secrets are variables with extra protection: masked in logs, never echoed; GitHub
${{ secrets.X }}, AzuresecretParameters. - Consumption is via expression syntax at build time
$(VAR)in Azure Pipelines and${{ env.VAR }}in GitHub Actions.
How it fits (diagram)
Exam notes
- Variables are resolved at runtime; secrets are a masked subset — do not print them.
- Precedence and scoping rules are frequent questions (same name = which wins).
- GitHub
env:at workflow/job vswith:to an action — know which scope applies where.
Related
pipeline-run · azure-pipelines · github-actions · advanced-yaml-pipelines
📘 Source: Azure Pipelines variables · YAML expressions