Este conteúdo não está disponível em sua língua ainda.
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 Azure Container Apps environment runs in a delegated subnet and/or your managed Azure services are exposed through private endpoints instead of public network access.
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 remains a public website model either way, so private networking there is primarily about the backing Azure services rather than the app’s public site endpoint.
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:
WithDelegatedSubnet configures the subnet delegation Azure Container Apps environments require.
AddPrivateEndpoint automatically creates the private DNS zone, virtual network link, and DNS zone group the target service needs.
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. App Service itself remains a public website model.
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.
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.