Repository navigation
How to generate environment-dependent Bicep expressions from Aspire? #18927
Unanswered
jakub-swastek
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi Aspire Team,
We're using Aspire to provision Azure resources, including Azure Cosmos DB.
For Cosmos DB we'd like to configure the backup policy dynamically based on the deployment environment:
Continuous30DaysContinuous7DaysIf deployment is performed exclusively through the Aspire CLI, handling this in C# is straightforward. However, we also generate Bicep locally and commit it as part of our workflow. During CI/CD, we regenerate the Bicep and compare it with the committed version to detect Aspire version mismatches (and then deploy via Aspire CLI).
While looking for a solution, I found the
BicepExpressiontype:https://learn.microsoft.com/en-us/dotnet/api/azure.provisioning.expressions.bicepexpression?view=azure-dotnet
However, I haven't been able to find much documentation or any practical examples showing how it can be used within Aspire/Azure Provisioning resources to emit conditional expressions into the generated Bicep and in a same time handle C# value assignment.
Is this a supported scenario? I'm starting to wonder whether Bicep generation is overengineering this use case.
Thanks!
All reactions