You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Azure Developer CLI (`azd`) composability (compose) feature enables you to progressively compose the Azure resources required for your app without manually writing Bicep code. Compose also uses [Azure Verified Modules (AVM)](https://aka.ms/avm) when possible, providing recommended practices using building blocks for Azure.
15
15
16
-
> [!NOTE]
17
-
> The `azd` compose feature is currently in alpha and shouldn't be used in production apps. Changes to alpha features in subsequent releases can result in breaking changes. Visit the [azd feature versioning and release strategy](/azure/developer/azure-developer-cli/feature-versioning) and [feature stages](https://github.com/Azure/azure-dev/blob/main/cli/azd/docs/feature-stages.md) pages for more information. Use the **Feedback** button on the upper right to share feedback about the `compose` feature and this article.
18
-
19
-
## Enable the compose feature
20
-
21
-
The `azd` compose feature is currently in alpha, which means you need to enable it manually. Visit the [azd feature stages](https://aka.ms/azd-feature-stages) page for more information.
22
-
23
-
```bash
24
-
azd config set alpha.compose on
25
-
```
26
-
27
16
## What is the compose feature?
28
17
29
18
The `azd` compose feature offers a new way to get started with `azd`. Before the compose feature, developers had two primary options to configure the Azure resources to provision and deploy an application:
@@ -33,6 +22,13 @@ The `azd` compose feature offers a new way to get started with `azd`. Before the
33
22
34
23
Any further customization required the user to manually modify the Bicep files—until the introduction of the compose feature.
35
24
25
+
## Project compatability with compose
26
+
27
+
The `azd` compose feature is designed for projects that don't already use infrastructure as code to manage Azure resources. As a result, compose does *not* support the following scenarios:
28
+
29
+
- Projects that already have an `infra` folder for Azure resource creation (such as existing templates).
30
+
- .NET Aspire projects, which use the Aspire app host file to manage resources.
31
+
36
32
### Streamline resource creation with compose
37
33
38
34
The `azd` compose feature introduces a third option to add Azure resources to your apps. Developers use the `azd add` command to instruct `azd` to compose new Azure resources and update template configurations using minimal prompt workflows. This feature is useful for developers who want to avoid writing Bicep or using an existing template.
Copy file name to clipboardExpand all lines: articles/azure-developer-cli/azd-init-workflow.md
+5-8Lines changed: 5 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,13 +17,13 @@ The Azure Developer CLI (`azd`) provides a set of commands to streamline develop
17
17
18
18
The `azd init` command supports several workflows to prepare your app to work with `azd`:
19
19
20
-
-**Use code in the current directory**: Analyzes an existing app codebase to generate appropriate `azd` configuration files and resources.
20
+
-**Scan current directory**: Analyzes an existing app codebase to generate appropriate `azd` configuration files and resources.
21
21
-**Select a template**: Clones and initializes a template from an `azd`[template gallery](azd-template-galleries.md).
22
22
-**Create a minimal project**: Initializes a basic `azure.yaml` file as a starting point for building your own `azd` template from scratch.
23
23
24
24
Choose the approach that best fits your project. All of these flows are outlined in more detail in the [Create templates overview](make-azd-compatible.md) and related articles. The following sections provide a conceptual overview of each flow.
25
25
26
-
### Use code in the current directory
26
+
### Scan current directory
27
27
28
28
Use this workflow when you have an existing app codebase and want to prepare it for deployment to Azure using `azd`.
29
29
@@ -34,13 +34,13 @@ Use this workflow when you have an existing app codebase and want to prepare it
34
34
azd init
35
35
```
36
36
37
-
3. Select **Use code in the current directory**. `azd` will:
37
+
3. Select **Scan current directory**. `azd` will:
38
38
- Scan your directory to determine the language or framework your app uses.
39
39
- Select an appropriate hosting platform, such as Azure Container Apps.
40
40
- Prompt you to add or remove discovered services if needed.
41
41
42
42
```output
43
-
? How do you want to initialize your app?Use code in the current directory
43
+
? How do you want to initialize your app?Scan current directory
44
44
45
45
(✓) Done: Scanning app code in current directory
46
46
@@ -110,12 +110,9 @@ For advanced users who want to start with a minimal setup and customize everythi
110
110
1. Run the `azd init` command:
111
111
112
112
```bash
113
-
azd init
113
+
azd init --minimal
114
114
```
115
115
116
-
> [!NOTE]
117
-
> You can also run `azd init` with the `--minimal` parameter to skip the workflow selection.
118
-
119
116
2. When prompted, enter a name for your `azd` template and press Enter.
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.
15
15
16
-
> [!NOTE]
17
-
> The `azd infra synth` feature is currently in alpha status and must be enabled before use:
18
-
> ```bash
19
-
> azd config set alpha.infraSynth on
20
-
>```
21
-
22
16
## How `azd compose` manages infrastructure state
23
17
24
18
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.
@@ -33,13 +27,29 @@ When you run the `azd infra synth` command, the in-memory state is converted int
33
27
To explore or customize the Bicep code used internally by `azd` to provision resources created by `azd add`, run the following command:
34
28
35
29
```bash
36
-
azd infra synth
30
+
azd infra gen
37
31
```
38
32
33
+
> [!NOTE]
34
+
> The `azd infra synth` command from earlier versions of `azd` is now an alias of azd `infra generate`, and will continue to work. However, a warning message will be displayed and the command might be removed in a future `azd` release.
35
+
39
36
This command generates the corresponding Bicep files in the `infra` folder of your app.
40
37
41
-
> [!NOTE]
42
-
> 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.
38
+
## Managing updates with Bicep generation
39
+
40
+
When you run the `azd infra gen` command, you exit the `azd compose` workflow and the simplified init process. From this point on, any changes you make to the generated Bicep files are no longer tracked by `azd compose`. If you modify the Bicep files and later run `azd infra gen` again, your manual changes will be overwritten by the newly generated code.
41
+
42
+
Here's how a typical workflow might look:
43
+
44
+
1. You use `azd add` to add new Azure resources to your project. These resources are managed internally by `azd`.
45
+
2. Once you've finished adding resources, you run `azd infra gen` to generate Bicep files for those resources in the project's `infra` folder. At this stage, the resources are no longer managed by the `azd compose` workflow.
46
+
3. You can now manually update the Bicep files as you continue developing your app.
47
+
4. If you add more resources or run `azd infra gen` again, the contents of the `infra` folder will be regenerated, and any manual changes will be lost.
48
+
49
+
For this reason, the compose feature is best suited for the following scenarios:
50
+
51
+
- Creating an initial set of Azure resources for your project, then managing further updates yourself by editing the Bicep files.
52
+
- Managing your Azure resources entirely through the compose feature without running `azd infra gen`.
Copy file name to clipboardExpand all lines: articles/azure-developer-cli/troubleshoot.md
+39Lines changed: 39 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -282,6 +282,45 @@ DOCKER_BUILDKIT=1 DOCKER_BUILD_ARGS="--no-cache" azd up
282
282
283
283
`azd pipeline config` is currently not supported in [DevContainers/VS Code Remote Containers](https://code.visualstudio.com/docs/devcontainers/containers).
284
284
285
+
## Compose feature errors
286
+
287
+
The `azd` compose feature is only available for specific project types. If you try to use compose commands like `azd add` or `azd infra gen` in an unsupported context, you may encounter the following errors.
288
+
289
+
### Incompatible project
290
+
291
+
If you see an `ERROR: incompatible project` message when running the `azd add` command, check the type of project you're working with. The `azd add` command is not supported for .NET Aspire projects or for `azd` templates that already have an `infra` folder defined. Attempting to use `azd add` with these project types will result in errors such as:
292
+
293
+
* ERROR: incompatible project: found Aspire app host
294
+
* ERROR: incompatible project: found infra directory and azure.yaml without resources
### Project does not contain infrastructure to generate
301
+
302
+
The error `ERROR: this project does not contain any infrastructure to generate` occurs when:
303
+
304
+
* You run `azd infra gen` without any compose resources defined in your project.
305
+
* In .NET Aspire projects, this error can also appear if `azd` cannot detect an Aspire App Host in the current directory.
306
+
307
+
To resolve this error, use `azd add` to add new resources before running `azd infra gen` or ensure your .NET Aspire project is structured correctly.
308
+
309
+
:::image type="content" source="media/troubleshoot/no-infrastructure-generate.png" alt-text="A screenshot showing the infrastructure error.":::
310
+
311
+
## Error resolving Azure resource
312
+
313
+
The command `azd show <name>` might fail with the error: `ERROR: resolving '<name>': AZURE_RESOURCE_<NAME>_ID is not set as an output variable`. This could happen for a number of reasons:
314
+
315
+
* The resource `<name>` does not exist in `azure.yaml` under the resources: node.
316
+
* The resource `<name>` has not been provisioned yet.
317
+
318
+
:::image type="content" source="media/troubleshoot/error-resolving-azure-resource.png" alt-text="A screenshot showing the azure resource error.":::
319
+
320
+
### Solution
321
+
322
+
Run `azd up` to provision the resources. You may need to run `azd infra gen` first to generate the updated Bicep including the resource `<name>`, then run `azd up`.
323
+
285
324
## Live metrics support for Python
286
325
287
326
Live Metrics (`azd monitor --live`) is currently not supported for Python apps. For more information, see [Live Metrics: Monitor and diagnose with 1-second latency](/azure/azure-monitor/app/live-stream#get-started).
0 commit comments