Skip to content
Docs Try Aspire
Docs Try

AzureFrontDoorExtensions Methods

Class Methods 2 members
Extension methods for adding Azure Front Door resources to an Aspire application.
AddAzureFrontDoor(IDistributedApplicationBuilder, string) Section titled AddAzureFrontDoor(IDistributedApplicationBuilder, string) extension IResourceBuilder<AzureFrontDoorResource>
Adds an Azure Front Door resource to the application model.
public static class AzureFrontDoorExtensions
{
public static IResourceBuilder<AzureFrontDoorResource> AddAzureFrontDoor(
this IDistributedApplicationBuilder builder,
string name)
{
// ...
}
}
builder IDistributedApplicationBuilder The distributed application builder.
name string The name of the resource.
IResourceBuilder<AzureFrontDoorResource> A reference to the ApplicationModel.IResourceBuilder`1 for chaining.

Azure Front Door is a global, scalable entry point that uses the Microsoft global edge network to create fast, secure, and widely scalable web applications. Use AzureFrontDoorExtensions.WithOrigin to add origins (backends) to the Front Door resource. Each origin gets its own Front Door endpoint, origin group, and route, so each backend app is independently routable via its own *.azurefd.net hostname.

For advanced scenarios (shared origin groups, path-based routing, custom routes), use AzureProvisioningResourceExtensions.ConfigureInfrastructure to customize the generated infrastructure directly.

Add an Azure Front Door resource with origins:
var api = builder.AddProject<Projects.Api>("api")
.WithExternalHttpEndpoints();
var web = builder.AddProject<Projects.Web>("web")
.WithExternalHttpEndpoints();
var frontDoor = builder.AddAzureFrontDoor("frontdoor")
.WithOrigin(api)
.WithOrigin(web);
WithOrigin(IResourceBuilder<AzureFrontDoorResource>, IResourceBuilder<T>) Section titled WithOrigin(IResourceBuilder<AzureFrontDoorResource>, IResourceBuilder<T>) extension IResourceBuilder<AzureFrontDoorResource>
Adds an origin (backend) to the Azure Front Door resource. Each origin gets its own Front Door endpoint with a distinct *.azurefd.net hostname, its own origin group, and a default route.
public static class AzureFrontDoorExtensions
{
public static IResourceBuilder<AzureFrontDoorResource> WithOrigin<T>(
this IResourceBuilder<AzureFrontDoorResource> builder,
IResourceBuilder<T> resource)
{
// ...
}
}
builder IResourceBuilder<AzureFrontDoorResource> The Azure Front Door resource builder.
resource IResourceBuilder<T> The resource to add as an origin (e.g., a project, container, or other compute resource with endpoints).
IResourceBuilder<AzureFrontDoorResource> A reference to the ApplicationModel.IResourceBuilder`1 for chaining.
Add multiple origins (each gets its own Front Door endpoint):
var frontDoor = builder.AddAzureFrontDoor("frontdoor")
.WithOrigin(api)
.WithOrigin(web);