Cloud PlatformsComplete guide

Azure Container Apps

Azure Container Apps runs containers on fully managed infrastructure, handling scaling, service discovery, ingress, certificates, and revision traffic-splitting without exposing Kubernetes cluster management.

Overview

Container Apps sit between Azure Functions and AKS in the control spectrum. The platform abstracts Kubernetes and KEDA, letting teams focus on container configuration, scaling rules, traffic policies, secrets, managed identity, and observability. Each app runs as one or more replicas inside a shared Container Apps Environment, scales to zero when idle, and routes traffic across revisions for safe deployments. Dapr integration adds distributed application runtime capabilities — state, pub/sub, service invocation, and bindings — as a sidecar. .NET Aspire can target Container Apps for cloud deployment directly from the AppHost manifest.

What you will learn

  • Model environments, apps, revisions, replicas, jobs, ingress, and internal discovery.
  • Design probes, lifecycle, scaling, and cold-start behavior for .NET containers.
  • Operate identity, secrets, registries, networking, and Dapr safely.
  • Release with revision traffic splitting and measurable promotion gates.
  • Troubleshoot image, probe, DNS, scaling, quota, and dependency failures.
  • Decide when Container Apps, Functions, App Service, or AKS is the better compute boundary.

Prerequisites

  • Containers, image registries, HTTP, DNS, and basic distributed systems.
  • ASP.NET Core health endpoints, configuration, logging, and graceful shutdown.
  • Azure identity, virtual networking, infrastructure as code, and observability basics.

When to use Azure Container Apps

Good fit

  • Containerized services or jobs need managed ingress, revisions, internal discovery, and event-driven scaling.
  • The team wants Kubernetes-backed capabilities without owning cluster operations.
  • Supported networking, region, quota, workload profile, and protocol capabilities fit.

Choose another approach when

  • The workload requires Kubernetes APIs, custom operators, daemon sets, privileged containers, or cluster-level control.
  • A simple web app fits App Service better or a trigger-centric handler fits Functions better.
  • Unsupported protocol, hardware, tenancy, networking, or regional requirements are mandatory.

Key concepts

Environment boundary

A Container Apps environment provides shared networking, internal DNS, logs, certificates, Dapr configuration, and workload profiles; choose its ownership deliberately.

Apps, revisions, and replicas

An app is the stable endpoint, a revision is an immutable versioned snapshot, and replicas are runtime instances that scale for each active revision.

Ingress and discovery

Managed HTTP or TCP ingress, internal names, custom domains, certificates, and traffic weights expose only the endpoints the workload requires.

Probes and lifecycle

Startup, liveness, and readiness probes answer different questions; graceful shutdown must stop new work and finish bounded in-flight work.

KEDA scaling

HTTP concurrency and event scalers create replicas from demand; minimum, maximum, polling, cooldown, and authentication shape behavior.

Jobs and services

Continuously running apps serve traffic, while manual, scheduled, and event-driven jobs execute finite tasks with completion and retry semantics.

Identity and secrets

Managed identity supports Azure access, registry pulls, and some scaler authentication; secret references still require rotation and access boundaries.

Releases and observability

Single or multiple revision mode, labels, traffic splitting, logs, metrics, traces, and deployment gates enable controlled rollouts.

Architecture

External traffic enters through managed ingress, routes to the active revision of a container app inside the environment, which scales with demand and calls dependencies via internal DNS or Dapr.

Managed ingress
Container Apps Environment
Scaled container app
Dapr + dependencies

Conceptual architecture · Adapt to your system context

Implementation walkthrough

The revision API is a .NET 10 service with revision metadata, separate probes, graceful readiness transitions, JSON logs, a non-root chiseled image, and Bicep for identity, HTTPS ingress, revision mode, probes, and bounded scaling.

  1. 01
    Define the environment

    Choose region, network, zone resilience, workload profile, logging destination, ownership, quotas, and isolation boundary.

  2. 02
    Build the container

    Publish a small non-root image, listen on the configured port, handle termination, scan dependencies, and identify it by digest.

  3. 03
    Expose correct health

    Implement startup, liveness, and readiness semantics that avoid restart loops and prevent traffic before dependencies are usable.

  4. 04
    Configure identity and network

    Assign minimal managed identity roles, private registry access, ingress exposure, DNS, egress, and private endpoints.

  5. 05
    Model scaling

    Select HTTP or event metrics, authenticate scalers, and set minimum, maximum, concurrency, cooldown, and queue behavior from tests.

  6. 06
    Create a revision

    Deploy immutable configuration and observe provisioning, probe, startup, dependency, and telemetry status before traffic.

  7. 07
    Shift traffic safely

    Use revision labels or percentages and promote based on latency, errors, saturation, and business results.

  8. 08
    Operate and recover

    Alert on replicas, restarts, revisions, quotas, and dependencies; rehearse rollback, regional recovery, and job replay.

Code example

A .NET Aspire AppHost publishes the Orders API to Azure Container Apps using the Azure Developer CLI publisher — the same local orchestration model extends to the cloud.

AppHost.cs
using Aspire.Hosting.Azure;

var builder = DistributedApplication.CreateBuilder(args);

var postgres = builder.AddAzurePostgresFlexibleServer("postgres")
    .AddDatabase("orders");

var serviceBus = builder.AddAzureServiceBus("messaging")
    .AddTopic("order-events", ["inventory-subscription"]);

var api = builder.AddProject<Projects.Orders_Api>("orders-api")
    .WithReference(postgres)
    .WithReference(serviceBus)
    .WithExternalHttpEndpoints();

builder.AddProject<Projects.Orders_Worker>("orders-worker")
    .WithReference(postgres)
    .WithReference(serviceBus);

builder.Build().Run();

// Deploy to Azure Container Apps:
// azd init && azd up
// Aspire generates the Container Apps manifest from the AppHost graph.

Testing strategy

Test the application, image, deployment contract, platform lifecycle, and scaling with production-shaped dependencies.

  • Unit test health state, configuration, idempotency, and shutdown behavior.
  • Build and scan the exact image, run it as non-root, and smoke all endpoints.
  • Compile and lint infrastructure definitions and inspect deployment previews.
  • Verify ingress, identity, DNS, registry, secret, and private dependency paths.
  • Load test cold start, sustained traffic, scale out, scale in, and downstream saturation.
  • Deploy a canary revision, inject failures, validate traffic gates, rollback, and recovery.

Security considerations

The platform removes cluster management but application, image, identity, network, and supply-chain security remain workload responsibilities.

  • Use trusted minimal base images, digest pinning, scanning, signing, and non-root execution.
  • Use managed identity and minimal RBAC for dependencies, registry pulls, and scalers.
  • Keep secrets out of images, command lines, templates, logs, and plain environment values.
  • Expose only required ingress and design private DNS and controlled egress completely.
  • Separate application and deployment identities and audit control-plane changes.
  • Patch and redeploy immutable images promptly; never repair running replicas manually.

Performance and scalability

Tune startup, replica resources, concurrency, and scale rules as one system with dependency limits.

  • Minimize image and startup work and reuse outbound clients and pools.
  • Measure cold and warm percentiles for each workload profile.
  • Set HTTP concurrency from per-replica testing, not platform defaults.
  • Cap replicas before downstream quotas and apply application backpressure.
  • Use event lag and age, not queue depth alone, to judge consumer health.
  • Track cost per request or job across idle, burst, and sustained profiles.

Deployment and operations

A safe release creates an observable immutable revision and moves traffic only after evidence.

  • Build once, scan and sign, push to a private registry, and deploy by digest.
  • Preview infrastructure and protect identity, network, scale, and deletion changes.
  • Wait for provisioning and probes before assigning traffic.
  • Canary with small traffic or a revision label and compare business and platform metrics.
  • Promote gradually, then deactivate old revisions according to rollback policy.
  • Retain deployment evidence and automate forward repair or tested traffic rollback.

Common problems and fixes

Revision fails to activate

Likely cause: The image, registry authorization, port, resource request, environment setting, or startup command is invalid.

Fix: Inspect system logs and revision state, verify digest pull access, target port, architecture, resources, and command locally.

Replica restarts repeatedly

Likely cause: Liveness begins too early or the process crashes, exhausts memory, or blocks startup.

Fix: Separate startup and liveness probes, inspect exit reason and logs, right-size resources, and remove blocking initialization.

App is healthy but receives no traffic

Likely cause: Readiness fails, ingress target port is wrong, traffic weight is zero, or the revision is inactive.

Fix: Check readiness from inside the replica, ingress configuration, active revision mode, labels, and weights.

App never scales from zero

Likely cause: The scaler cannot authenticate, metadata is wrong, or no supported event reaches it.

Fix: Inspect scale rule status, identity role and scope, trigger metadata, event lag, min replicas, and platform metrics.

Scale-out overloads a dependency

Likely cause: Replica and per-replica concurrency limits exceed downstream capacity.

Fix: Lower maximum replicas or concurrency, add backpressure and jitter, and coordinate dependency capacity.

Internal name fails to resolve

Likely cause: Apps are in different environments or private DNS and network paths are incomplete.

Fix: Verify environment membership, internal FQDN, VNet DNS, routes, firewalls, and private endpoint records.

Best practices

  • Treat each environment as a workload and network boundary with explicit owners.
  • Use immutable image digests from a private registry and run as a non-root user.
  • Separate startup, liveness, and readiness probes and test graceful termination.
  • Keep one minimum replica when user-facing cold-start latency is unacceptable.
  • Set maximum replicas and concurrency from downstream capacity and quota evidence.
  • Use managed identity for registry, dependency, and scaler access where supported.
  • Promote revisions progressively and gate traffic on health and business telemetry.
  • Monitor replica, restart, ingress, scale, dependency, revision, quota, and cost signals.

Production checklist

  • Environment ownership, region, network, quotas, resilience, and logging are approved.
  • Image is minimal, scanned, signed, digest-pinned, and runs non-root.
  • Startup, liveness, readiness, termination, and health dependencies are tested.
  • Managed identity and least-privilege registry, scaler, and dependency roles are verified.
  • Ingress, certificates, DNS, private networking, egress, and secrets are controlled.
  • Minimum, maximum, concurrency, cooldown, and job retry settings come from load tests.
  • Revision canary, promotion, rollback, deactivation, and recovery are automated.
  • Alerts and budgets cover user outcomes, replicas, restarts, scaling, dependencies, quotas, and cost.

Common interview questions

What creates a new revision?

Revision-scope changes such as container image, environment variables, resources, probes, and scale rules create an immutable revision; app-scope configuration can change without one.

Single versus multiple revision mode?

Single mode moves traffic to the newest ready revision; multiple mode allows several active revisions and explicit percentage or label routing.

Why separate liveness and readiness?

Liveness decides whether to restart a broken replica; readiness decides whether it should receive traffic, including during startup and graceful drain.

How does scale-to-zero affect HTTP APIs?

The first request after idle waits for replica activation, so startup time becomes user latency and dependencies may receive synchronized reconnects.

When should a Container Apps job be used?

For finite manual, scheduled, or event-triggered executions whose success is completion rather than a continuously addressable service.

How do managed identity scale rules help?

Supported KEDA Azure scalers can authenticate without storing broker secrets, reducing rotation and leakage risk while preserving least privilege.

What remains your responsibility?

Image security, application correctness, identity, data, scaling limits, traffic policy, network design, observability, recovery, cost, and incident response.

Dedicated GitHub sample

Clone, run, test, and modify the focused implementation created for this guide.

Verified sample

Container Apps Revision API

A revision-aware .NET 10 API with liveness and readiness, graceful drain, JSON logs, a non-root chiseled container, and Bicep for identity, ingress, probes, revisions, and scaling.

.NET 10Azure Container AppsDockerBicep
dedicated-samplerevisionshealth-probeskeda-scaling
Run
dotnet run --project src/ContainerAppsRevisionApi
Test
dotnet test ContainerAppsRevisionApi.slnx