

You can use templates to define variables that are used in multiple pipelines in one file. You can use a variable group to make variables available across multiple pipelines. There are naming restrictions for variables (example: you can't use secret at the start of a variable name). User-defined variables can be set as read-only.

When you set a variable in the UI, that variable can be encrypted and set as secret. You can also specify variables outside of a YAML pipeline in the UI. In YAML pipelines, you can set variables at the root, stage, and job level. When you define a variable, you can use different syntaxes (macro, template expression, or runtime) and what syntax you use will determine where in the pipeline your variable will render. Variables are different from runtime parameters, which are typed and available during template parsing. You can use variables with expressions to conditionally assign values and further customize pipelines.

A variable set in the pipeline root level will override a variable set in the Pipeline settings UI. A variable defined at the stage level will override a variable set at the pipeline root level. So, a variable defined at the job level can override a variable set at the stage level. When you define the same variable in multiple places with the same name, the most locally scoped variable wins. The value of a variable can change from run to run or job to job of your pipeline. All variables are stored as strings and are mutable. The most common use of variables is to define a value that you can then use in your pipeline. Variables give you a convenient way to get key bits of data into various parts of the pipeline. Service connections are called service endpoints, In Microsoft Team Foundation Server (TFS) 2018 and previous versions,īuild and release pipelines are called definitions,
