bicep
bicep copied to clipboard
Add --all parameter to bicep build
Is your feature request related to a problem? Please describe. When authoring bicep modules I tend to end up with multiple .bicep files in the same folder. It would be nice if I could build all .bicep files in a folder at the same time.
Describe the solution you'd like
I would like to have a --all
parameter to bicep build
that compiles all .bicep files in the working directory.
bicep build --all
- Compiles all .bicep files in the working directory.
bicep build --all --path /bicep/modules
- Compiles all .bicep files in the /bicep/modules folder.
Note that on OSX/Linux, you can currently achieve this with:
bicep build *.bicep
Or:
bicep build ./path/to/*.bicep
@anthony-c-martin ok, cool! I tried that on Windows but couldn't get it to work.
It's definitely more clunky on Windows - if using PowerShell you can do something like:
Get-ChildItem -Filter *.bicep | foreach { bicep build $_.FullName }
Or
Get-ChildItem -Path ./module/path -Filter *.bicep | foreach { bicep build $_.FullName }
I personally like this workaround that I was taught today.
Just run this one liner first in my terminal: function bbuild {bicep build (get-childitem *.bicep | % name)}
Then I can just run bbuild
in my terminal to execute the function every time I want to compile all my modules.
I personally like this workaround that I was thought today.
Very slick, thanks for sharing!
Took it one step further and created a Bicep PowerShell Module 😊
Awesome! I'll leave this open in case anyone wants to add this to the CLI, but this is a great alternative.
Note that on OSX/Linux, you can currently achieve this with:
bicep build *.bicep
Or:
bicep build ./path/to/*.bicep
Tried this on Ubuntu @anthony-c-martin and got this error
I ran az bicep build *.bicep
and got:
the following arguments are required: --file/-f
Examples from AI knowledge base:
az bicep build --file {bicep_file}
Build a Bicep file.
az bicep build --file {bicep_file} --stdout
Build a Bicep file and print all output to stdout.
az bicep build --file {bicep_file} --outdir {out_dir}
Build a Bicep file and save the result to the specified directory.
https://aka.ms/cli_ref
Read more about the command in reference docs
@ugreg my command was for the bicep CLI (not az CLI). Here's how I'd do it with az CLI:
- OSX/Linux:
for f in `find -name "*.bicep"`; do az bicep build -f $f; done
- Windows:
Get-ChildItem -Filter *.bicep | foreach { az bicep build -f $_.FullName }