Skip to content
forsback edited this page Dec 31, 2022 · 28 revisions

Bicep deployments using YAML based variables

Intro

Bicep deployments are typically done using one parameter file that maps directly to the Bicep file. Each parameter file needs to have exact parameter match for the deployment to succeed. This leads to a situation where parameter files are hard to share for other deployments. It is also beneficial to make Bicep deployments modular. Variables can be used instead of parameters. It has both advantages and some drawbacks such as secure parameters. The advantage is that you can create a variable file with sharable variables for many related deployments. Using a YAML based variable definition makes the variable file easy to maintain, as it is more human readable than the JSON format. We will be using MS provided Bicep resource modules in the example (https://github.com/Azure/ResourceModules). These contains extensive and well defined Bicep templates with related documenation.

Using variables

Bicep supports loading of variables loading of JSON files with variable definitions. ''' loadJsonContent('variables.json') '''

References

  1. Bicep resource modules, https://github.com/Azure/ResourceModules
  2. YQ YAML<-> JSON converter, https://github.com/mikefarah/yq

Clone this wiki locally