Tutorials Logic, IN info@tutorialslogic.com

Azure Containers: ACR, Container Apps, ACI, and AKS

Build and Protect Images

Azure Container Registry stores private images, while Container Apps, Container Instances, and Azure Kubernetes Service run containers with different orchestration responsibilities.

Container Apps suits many HTTP, event-driven, and microservice workloads that need revisions and autoscaling without direct Kubernetes management. AKS is appropriate when Kubernetes APIs and ecosystem control are requirements.

Safe container delivery includes an immutable image, registry controls, workload identity, secret management, network boundaries, health probes, scaling limits, and rollback.

Use small reproducible images, non-root execution, pinned dependencies, and vulnerability scanning. Push versioned tags or digests to ACR rather than replacing a mutable production tag.

  • Keep credentials and environment configuration out of layers.
  • Use managed identity for registry pulls where supported.
  • Apply registry retention and purge rules.

Select the Runtime

Use Container Instances for simple isolated jobs, Container Apps for managed revisions and autoscaling, and AKS when direct Kubernetes features or portability justify cluster operations.

  • Do not adopt AKS only because the artifact is a container.
  • Compare steady workload cost with serverless scaling behavior.
  • Document who owns upgrades and platform operations.

Identity, Secrets, and Networking

Assign a managed identity to the workload, retrieve secrets from Key Vault, and define ingress and egress deliberately. Private registry, private endpoints, and internal environments can reduce public exposure.

  • Do not bake Azure credentials into images.
  • Restrict inbound traffic to required entry points.
  • Verify private DNS and outbound dependency access.

Revisions, Probes, and Scaling

Use readiness and liveness probes that reflect application behavior. Release through revisions or controlled Kubernetes rollouts and define the metric and limits used for autoscaling.

  • Test rollback to the previous image digest.
  • Drain requests before stopping old replicas.
  • Centralize stdout, stderr, metrics, and deployment events.

ACR Image Contract

Build a minimal runtime image from a reviewed base, run as non-root where possible, and remove compilers and temporary credentials through multi-stage builds. Pin dependencies and rebuild when the base or packages are patched. A vulnerability scan is a decision input, not proof that application behavior is secure.

Push images to Azure Container Registry with a unique release tag and deploy by digest or another immutable reference. Do not deploy a reusable stable tag that can point replicas to different bytes. Lock released versions against accidental mutation or deletion where the registry process requires it, and use retention for unreferenced manifests.

Use managed identity, workload identity, or repository-scoped authorization rather than the registry admin account. Restrict registry networking, exports, and public access according to the design. Track source commit, build, bill of materials, scan, signature or provenance, digest, and deployed revision.

  • Deploy unique immutable image versions.
  • Keep build secrets out of layers and logs.
  • Disable broad registry administrator credentials.
  • Rebuild rather than patching running containers.

Container Instances Boundary

Azure Container Instances runs container groups without managing virtual machines or adopting a full orchestrator. It fits isolated jobs, burst helpers, build agents, and simple services that fit its current platform, network, storage, restart, and availability capabilities. It does not provide the complete service rollout and scheduling model of AKS or Container Apps.

A container group shares lifecycle, host, network, and storage among its containers. Use sidecars only when the group should be scheduled and stopped together. Set CPU, memory, restart policy, environment, identity, image pull, DNS, and logging explicitly. Store durable state outside the group.

Test image pull, startup, exit code, retry, timeout, network, file share, and cleanup. For jobs, record business completion in durable storage so a restarted or duplicated group cannot repeat unsafe effects. Move to an orchestrator when revisions, autoscaling, service discovery, rolling deployment, or fleet policy become required.

  • Use ACI for bounded simple container execution.
  • Keep durable state outside the container group.
  • Make retried jobs idempotent.
  • Adopt orchestration when service lifecycle requires it.

Container Apps Revisions

Azure Container Apps manages a container application inside an environment with ingress, revisions, scaling, identity, secrets, and observability. Revision-scope changes create immutable revisions, while application-scope settings can affect all revisions. Know which category a change belongs to before assuming rollback isolates it.

Single revision mode moves traffic after the candidate is ready; multiple revision mode can run revisions concurrently and split traffic. Configure startup, liveness, and readiness probes that reflect application behavior. Keep schema, events, secrets, and downstream permissions compatible while old and new revisions coexist.

KEDA-based scale rules can respond to HTTP or supported event sources. Set minimum and maximum replicas from latency and downstream capacity, authenticate scale rules with managed identity where supported, and understand scale-to-zero behavior. A queue can absorb bursts only while message age remains acceptable.

  • Separate revision-scope and app-scope changes.
  • Use readiness before shifting traffic.
  • Keep mixed revisions data-compatible.
  • Bound scaling by downstream capacity.

AKS Ownership Boundary

Azure Kubernetes Service manages the control plane under its service contract, while the customer owns node pools, Kubernetes objects, workload identity, network policy, ingress, storage, add-ons, observability, policy, backup, and supported-version upgrades. Managed does not mean Microsoft operates application namespaces and manifests.

Choose AKS when Kubernetes APIs, ecosystem, portability, scheduling, or existing platform skill provide concrete value. Container Apps is often a smaller operating model for HTTP and event-driven containers, while ACI is smaller for isolated execution. Do not adopt Kubernetes only because the artifact is a container image.

Plan cluster API access, Microsoft Entra integration, Azure RBAC or Kubernetes RBAC, workload identity, CNI address capacity, egress, private endpoints, node images, disruption budgets, storage classes, and add-on support. Test node and zone failure plus control-plane and node-pool upgrade.

  • Adopt AKS for explicit Kubernetes requirements.
  • Treat nodes, add-ons, and workloads as owned components.
  • Give workloads narrow federated identities.
  • Practice supported-version upgrades before deadlines.

Identity, Network, and Secrets

Use managed identity for Container Apps and ACI where supported and workload identity federation for AKS pods. Separate registry pull identity, deployment identity, node or platform identity, and application data identity. A container should not inherit broad Azure access merely because the cluster can administer resources.

Keep ingress and application backends private when required, restrict outbound paths, and plan DNS, private ACR access, subnet delegation, service CIDRs, load balancers, and private endpoints. Container Apps environments, ACI groups, and AKS have different network models; verify the selected environment rather than reusing one diagram.

Retrieve secrets from Key Vault or the platform secret mechanism with an explicit rotation plan. Environment injection can leave old replicas with old values. Restart or create revisions deliberately, avoid logging configuration dumps, and limit which container or service account can request each identity token.

  • Separate image pull, deployment, and runtime identity.
  • Design networking per container platform.
  • Coordinate secret rotation with running revisions.
  • Restrict token access inside multi-container workloads.

Release, Observe, and Upgrade

Use rolling, revision traffic splitting, blue-green, or canary release according to the platform, capacity, data compatibility, and rollback need. Define health, observation window, promotion signal, and automatic stop before release. Keep the previous image and configuration available until the data and message compatibility window closes.

Collect structured stdout and stderr, release identity, request traces, platform events, replica or pod status, restart reason, image pull errors, probe failures, saturation, backlog, and deployment history. Centralize logs with retention and redaction. A running container count does not prove useful service.

Exercise a bad image, unavailable registry, missing secret, failed probe, zone or node loss, scale-out, downstream throttle, and rollback. Track ACR, Container Apps, ACI, AKS, Kubernetes, node image, and add-on support lifecycles. Upgrade a representative environment before production and remove obsolete revisions and images after evidence is retained.

  • Predefine release and rollback signals.
  • Preserve platform events and stop reasons.
  • Test failure across image, identity, network, and capacity.
  • Upgrade platform and add-ons on a schedule.

Container Platform Lifecycle

Track ACR API and signing guidance, Container Apps environment and revision features, ACI platform limits, AKS Kubernetes versions, node images, CNI, ingress, CSI drivers, policy add-ons, and workload APIs. A valid image can still fail on an unsupported orchestrator or removed API.

Upgrade a representative environment first, inspect deprecations, replay deployments, and test network, storage, identity, autoscaling, disruption, and rollback. Keep workload manifests and Bicep aligned with supported API versions and remove obsolete images or add-ons after the observation window.

  • Treat platform and add-on support as scheduled work.
  • Test removed APIs before cluster or environment upgrades.

Disruption and Shutdown Contract

Handle termination signals, stop accepting new work, drain load-balancer connections, finish or checkpoint in-flight jobs within the platform grace period, and close telemetry and data clients. Container Apps scale-in, ACI restart, and AKS pod disruption have different controls, so test the selected platform rather than relying on one local Docker result.

Keep long work recoverable through queues, checkpoints, leases, or idempotent operations. A graceful handler improves normal rollout but cannot guarantee execution during host failure; durable business state must survive abrupt termination.

  • Test both graceful and abrupt termination.
  • Keep in-flight work recoverable outside the container.

Azure Container Examples

Deploy a Container App

Deploy a Container App
az containerapp up \
  --name orders-api \
  --resource-group rg-app-dev \
  --location centralindia \
  --image tlregistrydev.azurecr.io/orders-api:1.0.0 \
  --target-port 8080 \
  --ingress external

Shift Traffic Between Container App Revisions

A new revision shows elevated errors at 10% traffic.

Shift Traffic Between Container App Revisions
Constraints: Revisions are immutable, secrets are referenced, and rollback must not rebuild an image.
Decision: Hold the new revision at a small weight, compare telemetry by revision, then return all traffic to the known-good revision.
Verification: Error rate returns to baseline and the failed revision keeps logs and configuration for diagnosis.
Failure test: Scale the failed revision to zero and confirm the stable revision handles the full load.
Output
Expected evidence: Error rate returns to baseline and the failed revision keeps logs and configuration for diagnosis.
  • This is a worked engineering decision, so the result is operational evidence rather than terminal output.
Before you move on

Azure Containers: ACR, Container Apps, ACI, and AKS Mastery Check

5 checks
  • Images are immutable, scanned, and run without unnecessary privilege.
  • The runtime choice matches an explicit orchestration need.
  • Workloads use managed identity and external secret storage.
  • Ingress, egress, and registry access are intentional.
  • Health probes, scaling, and rollback have been tested.
Browse Free Tutorials

Explore 500+ free tutorials across 20+ languages and frameworks.