I have an Azure Devops Release pipeline that has a ARM template deployment step. It actually deploys a bicep file The bicep has the following output -
output deployedItems array = [for (location, i) in locations: {
item: module[i].outputs.app
}]
basically an array of objects from an earlier module in an array because the earlier module gets called in a For loop, once for each location passed in to the bicep
this deploys fine
in the ARM template deployment step, i have the "Deployment outputs" set to bicepOutput
all good so far
now, in a later step i want to access a property from this output and this is where the wheels kinda come off the bus.
the output looks similar to this (edited for brevity) - `
"deployedItems": {
"type": "Array",
"value": [
{
"item": {
"apiVersion": "2023-01-01",
"location": "Australia East",
"properties": {
"name": "testapp2".....
}
}
}
]
i am trying the following to access the name of the item from the above snippet
$(bicepOutput.deployedItems[0].item.properties.name)
but this does nothing. how do i get the value of this property from this output?
The output of the task is
stringformat, you need to parse to JSON object usingConvertFrom-JsonPowershell cmdlet in Powershell/Azure Powershell task and then that object can be used in same task or subsequent tasks.From the task:
From the task guide:
Here is a similar ticket with sample powershell for your reference.