Pass JSON array to Bicep file from Azure pipeline #15757
Replies: 3 comments
-
|
I have also come upon this problem which I could not solve. Would be great if someone could find a solution here! |
Beta Was this translation helpful? Give feedback.
-
|
I tried the solution described here and it works for my case: - task: AzureCLI@2
displayName: What-If Deploy Dev
inputs:
azureSubscription: $(azureServiceConnectionDev)
scriptType: pscore
scriptLocation: inlineScript
inlineScript: >
$functionAppNames = $(az functionapp list --query "[].name" -o json) -replace '"', "'";
az deployment group create
--resource-group rg-my-resource-group
--name WhatIf-$(Build.BuildNumber)
--template-file "$(Build.ArtifactStagingDirectory)/main.bicep"
--parameters
env=dev
functionAppNames="$functionAppNames"
--what-if |
Beta Was this translation helpful? Give feedback.
-
|
FIWW, Using standalone bicep.exe v0.39.26.0, your example works perfectly for me in the bicep console. "The configuration value of bicep.use_binary_from_path has been set to 'false'" means you're using the extension via AzCLI - might that have been out of date? Also, you may find passing json via files to be easier, in which case use the loadjsoncontent function.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to pass a JSON array from my Azure pipeline into a Bicep file using the format outlined here.
The JSON array looks like this:
[{"ip":"11.222.333.1/32","description":"Desc 1"},{"ip":"11.222.444.1/32","description":"Desc 2"}]To ensure the format is correct, I have currently defined the JSON string directly in the Bicep file as follows:
To read it, I'm using the following syntax that fails:
var ipAddressesArray = json(ipAddressesString)This results in the following error:
What am I doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions