This is the repository for the Bicep PowerShell Module. This is a community project created to enable the features provided by the Bicep CLI in PowerShell. The module provides the same functionality as Bicep CLI, plus some additional features to simplify the Bicep authoring experience.
Note: When new Bicep versions are released there will be a slight delay before the PowerShell module gets tested updated with the latest assemblies. If new functionality is added to Bicep CLI before the PowerShell module supports it, use
Install-BicepCLI
to install the latest Bicep CLI version and use the CLI while waiting for an updated PowerShell module.
Here are a few features (other than just a native PowerShell experience) that sets the Bicep PowerShell module apart from using the official Bicep CLI.
Build Bicep templates to ARM templates and convert ARM templates to Bicep. Build-Bicep supports various output formats such as file, string and hashtable. Use a directory as input to build all Bicep templates in the directory.
Since all required Bicep assemblies are loaded into memory with the module, the build commands are very fast which is especially useful when building a large number of Bicep templates in a for example a pipeline.
Export Azure resources as deployable bicep templates using Export-BicepResource. Find resources to export using a KQL query to search Azure Resource Graph or a list of ResourceIds. Using a KQL query in combination with the parameter -UseKQLResult
treat the output from Azure Resource Graph as a resource body used to generate a bicep template. This is a very performant way to export large quantities of resources. The parameter -RemoveUnknownProperties
will append a custom rewriter that will remove any property not found in the latest known type definition, this helps clean up templates but has a small risk of removing properties not found in the type definition schema. Use -IncludeTargetScope
when exporting resources that live outside of a ResourceGroup to append a targetScope declaration on the first line of each template.
By default, the command outputs a hashtable where the resourceId is the key and the template is the value, but using the parameter -AsString
will cause the command to only output templates as strings, this can for example be useful when exporting several resources to one file.
The command New-BicepMarkdownDocumentation
will generate a markdown document in the same folder as a bicep file containing documentation of, for example, the providers, resources, parameters variables and outputs of a template.
- Build-Bicep
- Build-BicepParam
- Clear-BicepModuleCache
- Connect-Bicep
- Convert-BicepParamsToDecoratorStyle
- Convert-JsonToBicep
- ConvertTo-Bicep
- Export-BicepResource
- Find-BicepModule
- Format-BicepFile
- Get-BicepApiReference
- Get-BicepConfig
- Get-BicepMetadata
- Get-BicepUsedModules
- Get-BicepVersion
- Install-BicepCLI
- New-BicepMarkdownDocumentation
- New-BicepParameterFile
- Publish-Bicep
- Restore-Bicep
- Test-BicepFile
- Uninstall-BicepCLI
- Update-BicepCLI
- Update-BicepParameterFile
- Update-BicepTypes
Use Connect-Bicep to create an authentication context for Bicep. If no context is created, Bicep will try to use the context from Azure PowerShell.
The following commands will communicate with Azure and requires authentication:
The Bicep PowerShell Module is published to PowerShell Gallery.
Install-Module -Name Bicep
To install the latest version in development use the -AllowPrerelease
switch.
Install-Module -Name Bicep -AllowPrerelease
Note: If you want to test the latest features before we've release it to PowerShell Gallery, see the Contribution Guide for instructions on how to manually download the dependencies and install the module manually.
If you find a bug or have an idea for a new feature create an issue in the repo. Please have a look and see if a similar issue is already created before submitting.
If you like the Bicep PowerShell module and want to contribute you are very much welcome to do so. Please read our Contribution Guide before you start! ❤
This project is actively maintained by the following coders: