kconner​.com

In your Azure DevOps Pipeline, if your variable group’s values are not showing up where you reference them, check the syntax. There are two ways to satisfy the variables key, and they mean different things.

First, if you supply a dictionary, you are creating literal variable names and values:

variables:
  name1: value1
  name2: value2

Second, if you supply an array of dictionaries, each item’s keys determine whether it’s a single variable or a group:

variables:
- group: group-name
- name: name1
  value: value1
- name: name2
  value: value2

(YAML can be a little confusing here. Each hyphenated line begins an array item, and since there is at least one of them, the outer value is an array. Each line with a colon is a name-value pair in a dictionary, and since there is at least one of them after each hyphen, each array item is a dictionary.)

If, like me, you saw the first syntax, then learned about variable groups, then glossed over the fact there were two syntaxes, you might end up with this:

variables:
  group: group-name
  name1: value1
  name2: value2

That syntax doesn’t reference a variable group, it creates a variable whose name is “group”. That’s a nasty silent failure for a newcomer.