az devops powershell 传递 space 分隔值

az devops powershell passing space delimited values

AZ devops 命令 az pipelines variable-group create 将 --variables 定义为“格式为 key=value space 分隔对的变量”

我需要创建一个包含 20 多个键=值对的变量组。我发现作为一个变量很难做到这一点。

这个命令行有效

 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 

我看过这篇很有希望的文章,但推荐的答案无效

知道如何实现吗?

您可以尝试以下方法。

$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,您可以关注