How to Use Variable Templates in Azure Pipelines
A variable template is a YAML file of variables that pipelines pull in under their variables key.
Define common variables once in a template, then include it from each pipeline so they all share the same values and updates land in one place.
Include a shared variable file
The main pipeline pulls variables from a template file alongside its own.
azure-pipelines.yml
variables:
- template: vars/common.yml
- name: serviceName
value: web
steps:
- script: echo "Deploying $(serviceName) to $(environmentName)"The template file
common.yml just declares reusable variables.
vars/common.yml
variables:
- name: environmentName
value: production
- name: region
value: eastusRelated guides
How to Run a Container Build in Azure PipelinesBuild and push a container image in Azure Pipelines with the Docker@2 task and an Azure Container Registry se…
How to Run a Matrix Across OS in Azure PipelinesRun a job across Linux, Windows, and macOS in Azure Pipelines with a strategy matrix that swaps the vmImage p…