Create a Bicep Artifact

Convert your existing Bicep code into Bluebricks packages to deploy Azure infrastructure across multiple environments with automated management and consistent workflows.

Prerequisites

  • Bluebricks CLI installed

  • Authenticated with Bluebricks (bricks login)

  • Existing Bicep code (.bicep files)

  • Azure account with appropriate permissions

Quick Start

1. Prepare your directory

cd ~/my-bicep-project

2. Run blueprint prepare

# Option 1: In-place (keeps original files)
bricks blueprint prepare --source . --iac-type bicep

# Option 2: With output directory (copies files to src/bicep/)
bricks blueprint prepare --source . --output ./dist --iac-type bicep

3. Verify the generated package

4. Publish the package

That's it! Your Bicep code is now a Bluebricks package ready for deployment.

How It Works

When you run bricks blueprint prepare, Bluebricks:

  • Validates your Bicep code structure and files

  • Copies your files to the output directory (copies to src/bicep/ only when using a different output directory)

  • Generates a basic bricks.json manifest with proper type specification

  • Prepares the package for publishing (actual parameter/output extraction happens during bricks blueprint publish)

This transformation enables automated Azure deployments and multi-environment management.

Example Structure

Before:

After (in-place, no output directory):

After (with output directory, refactor=false):

Supported Bicep Features

Bluebricks supports the full Bicep language including:

  • Resource declarations and modules

  • Parameters and outputs

  • Variables and functions

  • Loops and conditions

  • Azure resource types and providers

Test Your Package

Verify your package works correctly before deploying:

The dry run shows you the Bicep deployment plan without making any Azure changes.

Bicep File Requirements

File naming:

  • Any Bicep file name is supported (e.g., main.bicep, infrastructure.bicep)

  • Bluebricks defaults to main.bicep if not specified

  • Bicep files use .bicep extension

  • Files can be organized in subdirectories and modules

File handling:

  • Files are copied to src/bicep/ only when using --output with a different output directory

  • In-place preparation keeps files in their original location

Example structure:

Bicep Configuration

Parameters

Map Bicep parameters to Bluebricks inputs:

Becomes props in bricks.json:

Bluebricks native support: The @allowed decorator in Bicep automatically maps to Bluebricks' allowed_values key, providing input validation.

Outputs

Map Bicep outputs to Bluebricks outputs:

Becomes outs in bricks.json:

Best Practices

File Organization

  • Keep main template in main.bicep

  • Use modules/ directory for reusable components

  • Group related resources in modules

  • Use descriptive file and resource names

Parameter Design

  • Provide sensible defaults

  • Use descriptive parameter names

  • Include parameter descriptions

  • Validate parameter values

Output Management

  • Only output necessary values

  • Use descriptive output names

  • Include output descriptions

  • Consider downstream dependencies

Azure Integration

Resource Groups

Bicep artifacts work with Azure Resource Groups:

See also

Last updated

Was this helpful?