How to pass array from octopus variable to azure arm template parameter

488 Views Asked by At

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.

"parameters": {

"HighPriorityQueues": {

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

}

Octopus Variable

Name: HighPriorityQueue1 Value: events

Name: HighPriorityQueue2 Value: workflow

Name: HighPriorityQueue3 Value: scheduling

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.

I tried following way to define octopus variable but it doesn't work

Name: parameters: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

1

There are 1 best solutions below

0
On

I found workaround, I passed string variable from octopus with value "events,workflow,scheduling"

Inside arm template i used split function to generate array

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