Azure / arm-deploy

ARM action to deploy an Azure Resource Manager (ARM) template to all the deployment scopes
MIT License
84 stars 39 forks source link

Override parameters for bicep parameter files #139

Open Jarod1662 opened 1 year ago

Jarod1662 commented 1 year ago

I'm in the process of creating workflows to deploy bicep & bicepparam files and need to pass some overrides however when doing so the overrides are not being set when the workflow is running.

image image

Workflow error: image

I have tested using an ARM template and parameter file and this appears to be working as expected. image image

Any idea on how to resolve this issue?

dandreasen-uncomn commented 1 year ago

I am also seeing this issue using Bicep and bicepparam files and would like to give this a +1.

At this point, the resolution for me was to deploy the Bicep template along with a JSON ARM parameter file instead of a bicepparam file.

Jarod1662 commented 1 year ago

@bishal-pdMSFT @t-dedah - any update on this?

rdeveen commented 12 months ago

This is not possible (yet) because bicepparam doesn't support it. See: https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/parameter-files?tabs=Bicep#parameter-precedence

You can use the https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions-parameters-file#readenvironmentvariable function.

frasermclean commented 9 months ago

Just wanted to add my +1 to this. I am experiencing this issue on my project. When running the az deployment locally, you can provide multiple --parameters options to override parameter values specified in the bicepparam file. So it should be possible to get this action working correctly,

frasermclean commented 9 months ago

As a workaround, you could trying running a az bicep build-params --file yourfile.bicepparam to create a JSON parameters file dynamically on the Actions runner. Then use that JSON file and override the parameters.

jtomkiew-mng commented 6 months ago

Regarding workarounds, can confirm the action does not override bicepparam parameters if defined in parameters input, e.g.:

parameters: >-
  main.bicepparam
  customParameter=overrideValue

but it does work if specified in additionalArguments input, e.g.:

parameters: main.bicepparam
additionalArguments: >-
  -p customParameter=overrideValue
anthony-c-martin commented 6 months ago

I believe this should be fixed by https://github.com/Azure/azure-cli/pull/28826.

Jarod1662 commented 6 months ago

I believe this should be fixed by Azure/azure-cli#28826.

I believe this needs to be revisited. I've just tried the workaround as mentioned by @jtomkiew-mng and can confirm that's working as expected.