Bicep has had linting since version 0.4.1. It's a great way to ensure that your bicep files conform to best practices. Interestingly, when the linting feature first shipped, there wasn't an explicit lint command as part of the CLI. Instead, you had to run bicep build
and it would run the linter as part of the build process. This was a little confusing as it was not obvious that the linter was running.
As of version 0.21.1 there is a dedicated bicep lint
command. This is a nice step forwards; it allows you to explicitly lint your your code, rather than have it happen as a side effect of build. And it is useful if you want to run the linter as part of a CI/CD pipeline. What's more the bicep lint
command is now available in the Azure CLI as well. You can run az bicep lint
to lint your bicep files.
In this post we'll look at how to run lint Bicep in Azure Pipelines and GitHub Actions, and surface the output in the UI.