This doc mentions two ways to create a yml variable.
Explicit use of name
and value
attributes
variables:
- name: myvariable
value: myvalue
Another approach is a short-hand key: value approach.
variables:
myvariable: myvalue
I have noticed that if you're using variables for a template reference, you need to be explicit about the name and value. This will work.
variables:
- name: localTargetEnvironment
value: dev
- name: variablesTemplatePath
value: ../shared/variables-${{ variables.localTargetEnvironment }}.yml
- template: ${{ variables.variablesTemplatePath }}
But this will not work.
variables:
variablesTemplatePath: ../shared/variables-${{ variables.localTargetEnvironment }}.yml
- template: ${{ variables.variablesTemplatePath }}
When/why would I use one approach over another?