Skip to content

Commit d45de71

Browse files
authored
Merge pull request #7465 from alexwolfmsft/compose-updates
Compose workflow and other miscellaneous updates
2 parents f24cb2c + 240bd52 commit d45de71

File tree

8 files changed

+70
-28
lines changed

8 files changed

+70
-28
lines changed

articles/azure-developer-cli/azd-compose.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,6 @@ ms.custom: devx-track-azdevcli, devx-track-bicep
1313

1414
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.
1515

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-
2716
## What is the compose feature?
2817

2918
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
3322

3423
Any further customization required the user to manually modify the Bicep files—until the introduction of the compose feature.
3524

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+
3632
### Streamline resource creation with compose
3733

3834
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.

articles/azure-developer-cli/azd-init-workflow.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ The Azure Developer CLI (`azd`) provides a set of commands to streamline develop
1717

1818
The `azd init` command supports several workflows to prepare your app to work with `azd`:
1919

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.
2121
- **Select a template**: Clones and initializes a template from an `azd` [template gallery](azd-template-galleries.md).
2222
- **Create a minimal project**: Initializes a basic `azure.yaml` file as a starting point for building your own `azd` template from scratch.
2323

2424
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.
2525

26-
### Use code in the current directory
26+
### Scan current directory
2727

2828
Use this workflow when you have an existing app codebase and want to prepare it for deployment to Azure using `azd`.
2929

@@ -34,13 +34,13 @@ Use this workflow when you have an existing app codebase and want to prepare it
3434
azd init
3535
```
3636

37-
3. Select **Use code in the current directory**. `azd` will:
37+
3. Select **Scan current directory**. `azd` will:
3838
- Scan your directory to determine the language or framework your app uses.
3939
- Select an appropriate hosting platform, such as Azure Container Apps.
4040
- Prompt you to add or remove discovered services if needed.
4141

4242
```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
4444
4545
(✓) Done: Scanning app code in current directory
4646
@@ -110,12 +110,9 @@ For advanced users who want to start with a minimal setup and customize everythi
110110
1. Run the `azd init` command:
111111

112112
```bash
113-
azd init
113+
azd init --minimal
114114
```
115115

116-
> [!NOTE]
117-
> You can also run `azd init` with the `--minimal` parameter to skip the workflow selection.
118-
119116
2. When prompted, enter a name for your `azd` template and press Enter.
120117

121118
```output

articles/azure-developer-cli/compose-generate.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ ms.custom: devx-track-azdevcli, devx-track-bicep
1313

1414
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.
1515

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-
2216
## How `azd compose` manages infrastructure state
2317

2418
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
3327
To explore or customize the Bicep code used internally by `azd` to provision resources created by `azd add`, run the following command:
3428

3529
```bash
36-
azd infra synth
30+
azd infra gen
3731
```
3832

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+
3936
This command generates the corresponding Bicep files in the `infra` folder of your app.
4037

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`.
4353

4454
## Next steps
4555

22.1 KB
Loading
22.4 KB
Loading
21.9 KB
Loading
25.6 KB
Loading

articles/azure-developer-cli/troubleshoot.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,45 @@ DOCKER_BUILDKIT=1 DOCKER_BUILD_ARGS="--no-cache" azd up
282282

283283
`azd pipeline config` is currently not supported in [DevContainers/VS Code Remote Containers](https://code.visualstudio.com/docs/devcontainers/containers).
284284

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
295+
296+
:::image type="content" source="media/troubleshoot/incompatible-project-aspire.png" alt-text="A screenshot showing the incompatible .NET Aspire project error.":::
297+
298+
:::image type="content" source="media/troubleshoot/incompatible-project-infra.png" alt-text="A screenshot showing the incompatible project infrastructure error.":::
299+
300+
### 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+
285324
## Live metrics support for Python
286325

287326
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

Comments
 (0)