When you deploy Aspire apps to Azure, the base security posture comes from the deployment target you choose and the Azure resources you provision. This guide explains what Aspire configures for you by default and how to work with either the standard public networking model or the private-networked model, then harden the deployment with managed identities, Key Vault, and monitoring.
Azure Container Apps can expose internal-only or public endpoints. Use a delegated subnet when you want the environment inside your virtual network.
Azure App Service is a public website model for web-facing apps and APIs. Use managed Azure services for databases, caches, brokers, and other backing infrastructure instead of trying to run them on App Service.
Aspire supports both of these Azure networking models:
Model
What it means
Default public model
Your compute uses the target’s normal public ingress behavior, and managed Azure services stay on their standard public endpoints.
Private-networked model
Your apps and services avoid public network access through any combination of a delegated subnet for the Azure Container Apps environment, private endpoints for managed Azure services, and Azure Front Door Private Link for app ingress.
Azure Container Apps supports both models. If you don’t attach a delegated subnet, Aspire leaves the environment on the default platform-managed network. Azure App Service websites are public by default, so private networking there is primarily about the backing Azure services. To make the websites private, connect Azure Front Door to them over Private Link.
Aspire already handles several security basics for deployed Azure targets:
uses managed identities for deployment scenarios such as pulling images from Azure Container Registry
relies on platform-managed HTTPS behavior for public web ingress on Azure Container Apps and Azure App Service
flows connection information through resource references and configuration instead of requiring you to bake secrets into container images
These defaults are a good starting point. Some deployments can stay on the public model, while others need stronger network isolation for backing services.
Add private networking when you need network isolation
If you’re staying on the default public model, focus on identities, secrets, RBAC, service-specific firewall rules, and monitoring. When you need private connectivity, add the 📦 Aspire.Hosting.Azure.Network package so you can configure virtual networks, subnets, network security groups (NSGs), NAT gateways, and private endpoints in your AppHost.
For Azure Container Apps, a common production pattern is to place the environment in a delegated subnet and put private endpoints for backing Azure services in a separate subnet:
In publish and deploy flows, adding a private endpoint also disables public network access on the target Azure resource by default.
Resources that reference the target keep using the same connection information; private DNS resolves the hostname to the private IP inside the virtual network.
If you omit WithDelegatedSubnet and AddPrivateEndpoint, Aspire keeps using the default public model.
If you deploy compute to App Service instead of Azure Container Apps, the same private-endpoint guidance still applies to your backing Azure services.
You can also add NSG rules to the delegated and private-endpoint subnets, and attach a NAT gateway when you need tighter ingress and egress control or deterministic outbound IP addresses.
For service-specific requirements such as Service Bus Premium tier support and Azure SQL private-endpoint deployment scripts, see Azure Virtual Network.
Private endpoints and delegated subnets protect traffic between your apps and their backing services. To also control how users reach the apps, put Azure Front Door in front of them and call WithAzureFrontDoorPrivateLink (withAzureFrontDoorPrivateLink in TypeScript). Aspire disables public network access on the Azure Container Apps environment or on each Azure App Service website. No traffic reaches the apps until you approve the private endpoint connections.
Use the deployed Aspire Dashboard to inspect the compute resources that Aspire places in Azure Container Apps or Azure App Service, then use Application Insights and Azure Monitor alerts to detect suspicious behavior, repeated failures, or unusual traffic patterns after deployment:
The dashboard helps you inspect deployed compute resources, but it doesn’t surface managed Azure backing services as dashboard resources. Create Azure Monitor alerts for authentication failures, unexpected restarts, unusual latency spikes, and abnormal resource consumption across the app and its dependent Azure services.