azure-dev: .NET Aspire - Missing BICEP files when using azd infra synth command

Describe the bug As part of my learning, I have a simple .NET Aspire application created from a template and I am trying to generate BICEP files for this application via Azure Developer CLI. In order to achieve that, I am running azd infra synth. Command works fine and no errors are displayed in the console. However, there are missing BICEP files which should be generated (see details below).

To Reproduce

  1. Create .NET Aspire App
dotnet new aspire-starter --use-redis-cache -o AspireAzdWalkthrough
cd AspireAzdWalkthrough
dotnet run --project AspireAzdWalkthrough.AppHost\AspireAzdWalkthrough.AppHost.csproj
  1. Initialize the project
azd init
  1. Generate BICEP files
azd config set alpha.infraSynth on
azd infra synth

Expected behavior

  • infra/main.bicep file is generated.
  • infra/main.parameters.json file is generated.
  • infra/resoures.bicep file is generated.
  • AspireAzdWalkthrough.Web/manifests/containerApp.tmpl.yaml file is generated.
  • AspireAzdWalkthrough.ApiService/manifests/containerApp.tmpl.yaml file is generated.

Observed behavior

  • infra/main.bicep file is generated.
  • infra/main.parameters.json file is generated.
  • infra/resoures.bicep file is generated.
  • AspireAzdWalkthrough.Web/manifests/containerApp.tmpl.yaml file is NOT generated.
  • AspireAzdWalkthrough.ApiService/manifests/containerApp.tmpl.yaml file is NOT generated.

Environment Information on your environment: - .NET Aspire (Preview) - azd version 1.5.1 (commit 3856d1e98281683b8d112e222c0a7c7b3e148e96) - .NET 8 - Microsoft Visual Studio Enterprise 2022 (64-bit) - Preview | Version 17.9.0 Preview 2.0

Additional context Probably I am missing something here, thus, please let me know if you need any additional information.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 29 (13 by maintainers)

Commits related to this issue

Most upvoted comments

@christiannagel That was quite illuminating! From the logs, I believe the issue is due to azure.yaml is being created in the AppHost project directory instead of the solution directory (one directory above the AppHost and other projects).

To workaround this, I would:

  1. Move existing azure.yaml from AppHost/azure.yaml one directory up to azure.yaml. Then, rename the project path inside azure.yaml to point to AppHost/AppHost.csproj.
  2. For future projects, run azd init in the directory above AppHost.

In the meantime, we’ll think about how we can better handle or prevent this in the future.

Hi @christiannagel @BartNetJS @PedroAlmeida21 , I reviewed the generation code and found an error unreported within the infra synth generation that could skip the manifest generation. Would you be willing to download the private build from https://github.com/Azure/azure-dev/pull/3295 and rerun infra synth --debug? The error will likely be reported with this change, then the next step is figure out how to address the error.

To install for Windows, run in pwsh:

powershell -c "Set-ExecutionPolicy Bypass Process; irm 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/3295/uninstall-azd.ps1' > uninstall-azd.ps1; ./uninstall-azd.ps1;"
powershell -c "Set-ExecutionPolicy Bypass Process; irm 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/3295/install-azd.ps1' > install-azd.ps1; ./install-azd.ps1 -BaseUrl 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/3295' -Version '' -SkipVerify -Verbose;"

After install, run azd version, and it should print out as below:

$ azd version
azd version 1.5.1-pr.3469811 (commit 44277170ba55083b4ec7184b8bf2a4b695cc29a1)

Then run azd infra synth in the project.