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
- Create .NET Aspire App
dotnet new aspire-starter --use-redis-cache -o AspireAzdWalkthrough
cd AspireAzdWalkthrough
dotnet run --project AspireAzdWalkthrough.AppHost\AspireAzdWalkthrough.AppHost.csproj
- Initialize the project
azd init
- 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)
@christiannagel That was quite illuminating! From the logs, I believe the issue is due to
azure.yamlis 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:
azure.yamlfromAppHost/azure.yamlone directory up toazure.yaml. Then, rename theprojectpath insideazure.yamlto point toAppHost/AppHost.csproj.azd initin the directory aboveAppHost.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 synthgeneration 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 reruninfra 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:
After install, run
azd version, and it should print out as below:Then run
azd infra synthin the project.