Azure Bicep is a Domain Specific Language (DSL) for deploying Azure resources declaratively.
It is a language that is designed to be a more readable
and maintainable way to define Azure resources.
Bicep comes with a linter that detects various faults, but also comes with
online best practices which are not completely covered by the linter.
Web App Basic Linux
The following is a Bicep file that deploys a web app with a Linux app service plan.
It is the microsoft.web/webapp-basic-linux/main.bicep
sample template in the bicep playground.
Script
The file is linter clean, but some improvements could be made with best practices.
The following script will apply best practices to the Bicep file.
line numbers are added to the file content to help the LLM precisely locate the issues.
the script uses a builtin support for annotations
to generate parseable warnings and errors. Annotations are automatically integrated as problems
in VSCode or as build errors in the CI/CD pipeline.
added support to ignore false positives using the #disable-next-line genaiscript
comment
GPT-4 already knows about the best practices for Bicep, no need to repeat them!
Results
The LLM generates 3 annotations for the Bicep file. The annotations are surfaced
as squiggly lines in VSCode.