AzureBicepResourceAnnotation Class

Definition

Used to annotate resources as being potentially deployable by the Aspire.Hosting.Azure.AzureProvisioner.

public class AzureBicepResourceAnnotation : Aspire.Hosting.ApplicationModel.IResourceAnnotation
type AzureBicepResourceAnnotation = class
    interface IResourceAnnotation
Public Class AzureBicepResourceAnnotation
Implements IResourceAnnotation
Inheritance
AzureBicepResourceAnnotation
Implements

Remarks

The Aspire.Hosting.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 IResource will be detected by the Aspire.Hosting.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.

Constructors

AzureBicepResourceAnnotation(AzureBicepResource)

Used to annotate resources as being potentially deployable by the Aspire.Hosting.Azure.AzureProvisioner.

Properties

Resource

The AzureBicepResource derived resource.

Applies to