问题描述
AZ devops命令
az pipelines variable-group create
将-变量定义为“格式为键=值空间分隔对的变量”
我需要创建一个包含20个以上的key = value对的变量组。我发现很难作为变量来做到这一点。
此命令行有效
az pipelines variable-group create --name myname --variables “owner=Firstname Lastname” “application=cool-name”
我正在尝试做这样的事情:
$tags ={owner='Firstname Lastname' application='cool-name'}
az pipelines variable-group create --name owgroup --variables $tags
我看了看这篇有希望的文章,但建议的答案不起作用 Space separated values; how to provide a value containing a space
有什么想法可以实现吗?
解决方法
您可以尝试以下操作。
$tags=(“owner=Firstname Lastname”,“application=cool-name”)
az pipelines variable-group create --name owgroup --variables $tags
我没有AZ DevOps,但是在PowerShell ISE上使用Azure CLI验证了类似的情况。如果您在Bash上运行Az CLI,则可以遵循linked answer。