This project demonstrates how to use .AddBicepTemplate() in a .NET Aspire application to provision custom Azure infrastructure resources. The example shows how to create an Azure Health Data Services FHIR server alongside an Azure Storage account, with event integration between the two services.
Program.cs- The main Aspire application hostBicep/- Contains Bicep templates and C# extension methodsazurehealthfhirserver.bicep- Bicep template for FHIR server provisioningAzureBicepHealthFhirServer.cs- C# extension methods for Aspire integration
The application demonstrates a pattern for integrating custom Azure resources using Bicep templates in .NET Aspire:
- Define your Bicep template (
azurehealthfhirserver.bicep) - Create an extension method to add the resource (
AzureBicepHealthFhirServer.cs) - Use the extension method in your Aspire application host (
Program.cs)
var builder = DistributedApplication.CreateBuilder(args);
var storageAccount = builder.AddAzureStorage("mystorageacct");
var fhirServer = builder.AddHealthDataFhirServer("myazurehealth", storageAccount);
builder.Build().Run();The Bicep template creates:
- An Azure Health Data Services workspace and FHIR server
- Event Grid system topic for FHIR events
- Storage queue subscription for FHIR events