简体   繁体   English

如何将数组从章鱼变量传递给 azure arm 模板参数

[英]How to pass array from octopus variable to azure arm template parameter

Right now my json arm template parameter file looks like following where i am passing individual octopus variable value and it gets assigned into array inside template.现在我的 json arm 模板参数文件看起来像下面我传递单个章鱼变量值的地方,它被分配到模板内的数组中。

"parameters": { “参数”: {

"HighPriorityQueues": {

  "value": [
    "#{HighPriorityQueue1}",
    "#{HighPriorityQueue2}",
    "#{HighPriorityQueue3}"
  ]
}

} }

Octopus Variable八达通变量

Name: HighPriorityQueue1 Value: events名称:HighPriorityQueue1 值:事件

Name: HighPriorityQueue2 Value: workflow名称:HighPriorityQueue2 值:工作流

Name: HighPriorityQueue3 Value: scheduling名称:HighPriorityQueue3 值:调度

I am looking for solution where i can pass entire array from octopus so i don't have to make any change in template in future if there is any new value in array.我正在寻找可以从章鱼传递整个数组的解决方案,因此如果数组中有任何新值,我以后不必对模板进行任何更改。 I should be able to update octopus array variable and simply redeploy to add new azure resource.我应该能够更新章鱼数组变量并简单地重新部署以添加新的 azure 资源。

I tried following way to define octopus variable but it doesn't work我尝试了以下方式来定义章鱼变量,但它不起作用

Name: parameters:HighPriorityQueues名称:参数:HighPriorityQueues

Value: ["events", "workflow", "scheduling"]值:[“事件”、“工作流程”、“调度”]

Does anyone know how to pass array from octopus?有谁知道如何从章鱼传递数组? I would really appreciate if you can help me here.如果您能在这里帮助我,我将不胜感激。

Thanks谢谢

I found workaround, I passed string variable from octopus with value "events,workflow,scheduling"我找到了解决方法,我从章鱼传递了字符串变量,其值为“事件、工作流、调度”

Inside arm template i used split function to generate array在 arm 模板中,我使用拆分 function 生成数组

"HighPriorityQueuesArray": "[split(parameters('HighPriorityQueues'), ',')]" "HighPriorityQueuesArray": "[split(parameters('HighPriorityQueues'), ',')]"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM