azure-powershell - az devops powershell 传递空格分隔的值
问题描述
AZ devops 命令
az pipelines variable-group create
将 --variables 定义为“格式为键=值空格分隔对的变量”
我需要创建一个包含 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,则可以按照链接的答案进行操作。
推荐阅读
- javascript - 如何在 HTML 上打印 JavaScript 爬取的内容
- python - 使用列表似乎无法将工作日与数字相匹配
- cakephp - cakePHP updateAll() 的用法:可以知道 $condition 是否满足?
- c - 用于数组的 for 循环的替代实现
- apache-kafka - 将 REST 代理连接到 Confluent Cloud 尝试连接到 Zookeeper
- java - 如何仅在Android中的特定时间段启用按钮?
- slider - 通过点击设置 SwiftUI 滑块的值
- python-3.x - 在给定范围内查找方程的所有根
- javascript - 如何访问减速器中数组对象中的特定项目
- postman - Postman 访问存储在数据库 leveldb 中的结果