This repository contains an opinionated template for using Azure Bicep for IaC and includes CI definitions for Azure DevOps. Other things of note:
- Can handle multiple environments with different configuration (comes with
dev
,uat
,preprod
andprod
out of the box) - Azure DevOps pipelines should just work (some AzDo setup required, see extra docs)
- Some useful scripts (currently just one)
Make sure you've got the following installed:
- Git
- Visual Studio Code
- Azure CLI
- Bicep - install via the Azure CLI
- This repo is known to work with Bicep v0.15.31 and you can install this version by running
az bicep install --version v0.15.31
. Later versions will probably work fine but, as things are changing rapidly in Bicep land, it's not guaranteed!
- This repo is known to work with Bicep v0.15.31 and you can install this version by running
When you open the repo in VSCode, make sure you install all the recommended extensions!
As noted above, this is an opinionated setup! Here are some things to bear in mind:
- All Bicep linting issues are marked as errors
- You should define your actual resources in modules - see the network module as an example.
- The
shared_vars
object should contain everything that might be needed by mutliple modules - Module outputs should be named identically to the module itself. Taking the network module as an example, variables would be available under
network.outputs.network
(this is a bit unwieldly but ultimately tidier IMO) - All Bicep deployments should be done by CI (configuration for AzDo is included). If you really need to run locally, have a look at the deployment file to see what to do.
Working out the name for the Azure Resource you want is non trivial; the names are tenuous at best! Luckily they're all written down in their reference documentation here. Even with this it isn't super obvious, but it will confirm what parameters are available. This also includes links to examples - these can be really helpful to see an example that should work.
The Azure DevOps YAML reference is here.
Contributions are very welcome! Some things I want to add include:
- Example configurations for other CI tools
- Updating the Bicep version as we go and ensuring (for example) the
bicepconfig.json
file contains all settings
MIT