1

The AZ devops command az pipelines variable-group create takes --variables defined as "Variables in format key=value space separated pairs"

I need to create a variable group with 20+ key=value pairs. I'm finding it hard to do so as a variable.

This command line works

 az pipelines variable-group create --name myname --variables “owner=Firstname Lastname” “application=cool-name” 

I'm trying to do something like this:

$tags ={owner='Firstname Lastname' application='cool-name'} 
az pipelines variable-group create --name owgroup --variables $tags 

I looked at this article that showed promise but the recommended answer(s) doesn't work Space separated values; how to provide a value containing a space

Any ideas how this can be accomplished?

user2503078
  • 737
  • 1
  • 8
  • 24

1 Answers1

2

You could try the following.

$tags=(“owner=Firstname Lastname”, “application=cool-name”)
az pipelines variable-group create --name owgroup --variables $tags

I have not AZ DevOps but validate a similar scenario with Azure CLI on PowerShell ISE. If you are running Az CLI on Bash, you could follow your linked answer.

enter image description here

Nancy
  • 26,865
  • 3
  • 18
  • 34
  • 1
    who knew an array would work when defined as "Variables in format key=value space separated pairs", but it did, thanks for that help! – user2503078 Aug 18 '20 at 13:12