external help file | Module Name | online version | schema |
---|---|---|---|
Bicep-help.xml |
Bicep |
2.0.0 |
Builds one or more .bicep files.
Build-Bicep [[-Path] <String>] [[-OutputDirectory] <String>] [-ExcludeFile <String[]>]
[-GenerateAllParametersFile] [-GenerateRequiredParametersFile] [-NoRestore] [-Compress]
[-WhatIf] [-Confirm] [<CommonParameters>]
Build-Bicep [[-Path] <String>] [[-OutputPath] <String>] [-ExcludeFile <String[]>] [-GenerateAllParametersFile]
[-GenerateRequiredParametersFile] [-NoRestore] [-Compress] [-WhatIf]
[-Confirm] [<CommonParameters>]
Build-Bicep [[-Path] <String>] [-ExcludeFile <String[]>] [-AsHashtable] [-NoRestore]
[-WhatIf] [-Confirm] [<CommonParameters>]
Build-Bicep [[-Path] <String>] [-ExcludeFile <String[]>] [-AsString] [-NoRestore]
[-WhatIf] [-Confirm] [<CommonParameters>]
Build-Bicep is equivalent to the Bicep CLI command 'bicep build' but with some additional features.
- Compile all files in a directory
- Generate ARM Template Parameter files
- Output ARM Template directly as string or hashtable without writing to file
Any error or warning from bicep will be written to the information stream. To save output in a variable, use stream redirection. See example below.
Build-Bicep -Path vnet.bicep
Build-Bicep -Path 'c:\bicep\modules\vnet.bicep' -OutputDirectory 'c:\armtemplates\vnet.json'
Build-Bicep -Path 'c:\bicep\modules\'
Build-Bicep -Path 'c:\bicep\modules\' -ExcludeFile vnet.bicep
Build-Bicep -Path '.\vnet.bicep' -AsString
Example 6: Compile a .bicep files in the working directory and generate a parameter file with all parameters
Build-Bicep -Path '.\vnet.bicep' -GenerateAllParametersFile
$Template=Build-Bicep -Path '.\vnet.bicep' -AsHashtable
New-AzResourceGroupDeployment -ResourceGroupName vnet-rg -TemplateObject $Template
Build-Bicep -Path 'c:\bicep\modules\vnet.bicep' -OutputPath 'c:\armtemplates\newvnet.json'
Build-Bicep -Path '.\main.bicep' -NoRestore
Build-Bicep -Path '.\main.bicep' -Compress
The -AsHashtable prints all output as a hashtable instead of corresponding files.
Type: SwitchParameter
Parameter Sets: AsHashtable
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The -AsString prints all output as a string instead of corresponding files.
Type: SwitchParameter
Parameter Sets: AsString
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Compress the built ARM Template to reduce file size
Type: SwitchParameter
Parameter Sets: Default, OutputPath
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies a .bicep file to exclude from compilation
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Generate an ARM template parameter file with all parameters from the bicep file.
Type: SwitchParameter
Parameter Sets: Default, OutputPath
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Generate an ARM template parameter file with the required parameters from the bicep file.
Type: SwitchParameter
Parameter Sets: Default, OutputPath
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Skips trying to restore dependent modules
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the target directory where the compiled files should be created
Type: String
Parameter Sets: Default
Aliases:
Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specify the filename of the generated ARM template.
Type: String
Parameter Sets: OutputPath
Aliases:
Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specfies the path to the directory or file that should be compiled
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: $pwd.path
Accept pipeline input: False
Accept wildcard characters: False
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Go to module repository https://github.com/PSBicep/PSBicep for detailed info, reporting issues and to submit contributions.