Validate Bicep config during CI/CD with Azure DevOps

Bicep scripts are ideally part of the source code and can also be used as such in the build process of the application.

This allows us to perform potential bugs in bicep scripts and modules during the build, well before the script actually runs and generates Azure resources. This increases quality and reduces error rates.

Bicep build to validate

Conveniently, validation is already built into Bicep and occurs during the build command.

1➡  az bicep build --file ./.bicep/main.bicep
2C:\source\ba\demo\bicep\main.bicep(8,7) : Warning no-unused-params: Parameter "storageName" is declared but never used.
3C:\source\ba\demo\bicep\main.bicep(57,38) : Error BCP052: The type "outputs" does not contain property "planId".

Azure DevOps Pipeline Task

The Azure CLI can now be easily used for example in Azure DevOps to validate via the build command.

1    - script: az bicep build --file ./.bicep/main.bicep
2      displayName: Bicep build

Let's Work Together

Looking for an experienced Platform Architect or Engineer for your next project? Whether it's cloud migration, platform modernization or building new solutions from scratch - I'm here to help you succeed.

New Platforms
Modernization
Training & Consulting

Comments

Twitter Facebook LinkedIn WhatsApp