AzureBicepResourceAnnotation
Azure.AzureProvisioner. namespace Aspire.Hosting.Azure;
public class AzureBicepResourceAnnotation : Aspire.Hosting.ApplicationModel.IResourceAnnotation{ // ...}Remarks
Section titled Remarks The Azure.AzureProvisioner is only capable of deploying resources that implement IAzureResource and only has built-in deployment logic for resources that derive from AzureBicepResource. This annotation that can be added to any ApplicationModel.IResource will be detected by the Azure.AzureProvisioner and used to provision an Azure resource for an Aspire resource type that does not itself derive from AzureBicepResource.
For example, the following code adds a https://learn.microsoft.com/dotnet/api/aspire.hosting.applicationmodel.sqlserverserverresource resource to the application model. This type does not derive from AzureBicepResource but can be annotated with AzureBicepResourceAnnotation by using the AzureSqlExtensions.AsAzureSqlDatabase() extension method.
var builder = DistributedApplication.CreateBuilder();builder.AddAzureProvisioning();var sql = builder.AddSqlServerServer( "sql"); // This resource would not be deployable via Azure Provisioner.sql.AsAzureSqlDatabase( ); // ... but it now is because this adds the AzureBicepResourceAnnotation annotation.