Skip to content

Latest commit

 

History

History
240 lines (188 loc) · 5.35 KB

Build-BicepParam.md

File metadata and controls

240 lines (188 loc) · 5.35 KB
external help file Module Name online version schema
Bicep-help.xml
Bicep
2.0.0

Build-BicepParam

SYNOPSIS

Builds one or more .bicepparam files.

SYNTAX

Default (Default)

Build-BicepParam [[-Path] <String>] [[-OutputDirectory] <String>] [-ExcludeFile <String[]>] [-Compress]
 [-WhatIf] [-Confirm] [<CommonParameters>]

OutputPath

Build-BicepParam [[-Path] <String>] [[-OutputPath] <String>] [-ExcludeFile <String[]>] [-Compress]
 [-WhatIf] [-Confirm] [<CommonParameters>]

AsHashtable

Build-BicepParam [[-Path] <String>] [-ExcludeFile <String[]>] [-AsHashtable]
 [-WhatIf] [-Confirm] [<CommonParameters>]

AsString

Build-BicepParam [[-Path] <String>] [-ExcludeFile <String[]>] [-AsString]
 [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

Build-BicepParam is equivalent to the Bicep CLI command 'bicep build-params' but with some additional features.

  • Compile all bicepparam files in a directory
  • Output ARM Template parameters 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.

EXAMPLES

Example 1 Compile single bicepparam file in working directory

Build-BicepParam -Path vnet.bicep

Example 2: Compile single bicepparam file and specify the output directory

Build-BicepParam -Path 'c:\bicep\modules\vnet.bicepparam' -OutputDirectory 'c:\armtemplates\vnet.parameters.json'

Example 3: Compile all .bicepparam files in a directory

Build-BicepParam -Path 'c:\bicep\modules\'

Example 4: Compile all .bicepparam files in the working directory except vnet.bicepparam

Build-BicepParam -Path 'c:\bicep\modules\' -ExcludeFile vnet.bicepparam

Example 5: Compile a .bicepparam file and output as string

Build-BicepParam -Path '.\vnet.bicep' -AsString

Example 7: Compile a .bicepparam file as hashtable and pass it to New-AzResourceGroupDeployment

$ParameterObject = Build-BicepParam -Path '.\vnet.bicepparam' -AsHashtable
New-AzResourceGroupDeployment -ResourceGroupName vnet-rg -TemplateObject $Template -TemplateParameterObject $ParameterObject

Example 8: Compiles single bicepparam file and saves the output as the specified file path.

Build-BicepParam -Path 'c:\bicep\modules\vnet.bicepparam' -OutputPath 'c:\armtemplates\newvnet.parameters.json'

Example 10: Compile a .bicep file and compress the outputted ARM Json

Build-BicepParam -Path '.\main.bicep' -Compress

PARAMETERS

-AsHashtable

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

-AsString

The -AsString prints all output as a string instead of corresponding files.

Type: SwitchParameter
Parameter Sets: AsString
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Compress

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

-Confirm

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

-ExcludeFile

Specifies a .bicepparam 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

-OutputDirectory

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

-OutputPath

Specify the filename of the compiled file.

Type: String
Parameter Sets: OutputPath
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Path

Specfies the path to the directory or file that should be compiled

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

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

CommonParameters

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.

INPUTS

None

OUTPUTS

System.Object

NOTES

RELATED LINKS