AzureFrontDoorPrivateLinkExtensions Methods
WithAzureFrontDoorPrivateLink(IResourceBuilder<T>, IResourceBuilder<AzureFrontDoorResource>) Section titled WithAzureFrontDoorPrivateLink(IResourceBuilder<T>, IResourceBuilder<AzureFrontDoorResource>)extensionIResourceBuilder<T> public static class AzureFrontDoorPrivateLinkExtensions{ public static IResourceBuilder<T> WithAzureFrontDoorPrivateLink<T>( this IResourceBuilder<T> environment, IResourceBuilder<AzureFrontDoorResource> frontDoor) { // ... }}Parameters
environmentIResourceBuilder<T> The compute environment to connect to.frontDoor IResourceBuilder<AzureFrontDoorResource> The Azure Front Door, created with AzureFrontDoorExtensions.AddAzureFrontDoor , whose origins in environment use Private Link. Returns
IResourceBuilder<T> A reference to the ApplicationModel.IResourceBuilder`1 for environment, for chaining.Exceptions
ArgumentNullExceptionenvironment or frontDoor is null.InvalidOperationException Publishing fails for existing or Express Container Apps environments, when frontDoor has no origin in the environment, and when another Front Door has an origin in the environment without being connected to it. Remarks
Add the apps to the Front Door with Azure, before or after this call. When publishing, every origin of front that runs in environment becomes a Private Link origin: the Front Door profile uses the Premium SKU, and the origin connects to the environment through a Front Door managed private endpoint. The apps must expose external HTTP endpoints, for example with With. Origins in other compute environments are left as they are.
Like a private endpoint to any other Azure resource, the Private Link disables public network access to the environment. Apps in the environment are no longer reachable from the Internet except through Front Door. Callers outside the environment must reach the apps through the Front Door, or through a route of their own.
An Azure Container Apps environment can only have its public network access disabled when Aspire provisions it, so it can't be marked as existing, and it must be a workload profiles environment, not an Azure Container Apps Express environment.
For Azure App Service, each origin targets its own website with the sites group ID, not the App Service plan. Public network access is disabled on all workload websites in the connected environment, including websites that are not Front Door origins. The separately provisioned Aspire dashboard is unchanged. Existing App Service plans are supported because Aspire still provisions the websites. Front Door Private Link cannot target a deployment slot, so with With each origin targets the production site and the slot, which has public access disabled and no private endpoint, is not reachable through Front Door: deploy to the slot and swap it into production. The production site is created only if it does not exist, so enabling this on a site that already exists doesn't disable its public access. Unlike Container Apps, App Service does not provide an environment-local ingress route between apps: service-to-service callers must use Front Door URLs or configure their own private network access and DNS.
Front Door creates a connection request in the Pending state, and no traffic reaches the apps until the owner of the target approves it. Approve it in the Azure portal, under the Container Apps environment's or each App Service website's networking settings, or with the Azure CLI by finding the request with az network private- and approving it with az network private-. Front Door can create more than one request; approve each one that has the message of this connection. Traffic starts flowing a few minutes after approval.
Front Door creates its private endpoint in the region of environment. Front Door Private Link is only available in some regions, so for an environment in another region the private endpoint is created in the supported region of the same geography, such as westus2 for westus, at the cost of an extra network hop. Deployment fails when the geography has no supported region. To choose another region, set the origin's Shared in Azure on front, for example to a parameter.
Private Link has no run-mode counterpart, so this method does nothing when the AppHost runs locally.
Examples
var environment = builder.AddAzureContainerAppEnvironment("env");var frontDoor = builder.AddAzureFrontDoor("frontdoor");environment.WithAzureFrontDoorPrivateLink(frontDoor);
var api = builder.AddDotnetProject("api", "../Api/Api.csproj") .WithExternalHttpEndpoints();var web = builder.AddDotnetProject("web", "../Web/Web.csproj") .WithExternalHttpEndpoints() .WithReference(api);frontDoor.WithOrigin(api).WithOrigin(web);