Edit

Share via


Generate Bicep using the compose feature

The Azure Developer CLI (azd) compose feature simplifies the process of building, deploying, and managing cloud applications. By using azd compose, you can define and manage the infrastructure and application code for your project in a unified way. This guide explains how to generate Bicep code from the azd compose feature, enabling you to customize your cloud infrastructure to meet your specific requirements.

Note

The azd infra synth feature is currently in alpha status and must be enabled before use:

azd config set alpha.infraSynth on

How azd compose manages infrastructure state

The azd compose feature tracks your infrastructure state in-memory during the composition process. This approach allows you to iteratively define and refine your application and infrastructure without immediately generating files or modifying your project directory.

When you run the azd infra synth command, the in-memory state is converted into Bicep files in the infra folder. At this point, the infrastructure state transitions from being managed in-memory to being represented as code, allowing for further customization.

Tip

Use azd compose to quickly prototype your infrastructure before committing to file-based changes with azd infra synth.

Generate the Bicep code

To explore or customize the Bicep code used internally by azd to provision resources created by azd add, run the following command:

azd infra synth

This command generates the corresponding Bicep files in the infra folder of your app.

Note

Running the azd infra synth command exits you from the azd compose feature and the simplified initialization process. Any changes you make to the generated Bicep files are not tracked by azd compose. For example, if you edit the Bicep code and then run azd infra synth again, azd overwrites your changes with the regenerated code.

Next steps