📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

📚 Interview question

You are starting a new .NET 10 API on Azure. How do you choose between App Service, Azure Functions, Container Apps and AKS? Compare them on cost, control, scaling and the operations work your team takes on, and tell me when you would move from one to another.

Choosing an Azure compute option for .NET 10 (App Service, Functions, Container Apps, AKS) by cost model, control, scaling, networking and operational burden, and when to migrate between them.

Intermediate Theory Intermediate aks app-service azure azure-functions container-apps devops

🎯 Key points

  • App Service: code or container, per-plan pricing, slots, lowest friction
  • Functions: event triggers, Flex Consumption, scale per event, execution limits
  • Container Apps: Kubernetes under the hood with KEDA, Dapr, revisions, scale to zero
  • AKS: full Kubernetes API, node pools, highest ops and skills cost
  • Decide on team skills, number of services, scaling shape and networking needs
  • Cost model: always-on plan vs per-use vs node VMs
  • Start simple and move when a real limit is hit

⏱ 30-second answer

I choose by how much platform the team wants to run:

  • App Service: one or a few web apps, always on, deployment slots, almost no ops. Paid per plan instance.
  • Azure Functions: event-driven or spiky work (queues, timers, blobs); Flex Consumption scales per event and to zero.
  • Container Apps: containerised microservices on managed Kubernetes with KEDA scaling, revisions and scale to zero, without touching the cluster.
  • AKS: full Kubernetes when you need its API, custom networking or many services and have a platform team.

The trade-off is control versus operations: each step towards AKS gives more control and more work. I start with the simplest option that meets the requirements and move only when I hit a concrete limit.

🗣 Full answer (senior)

How I would answer this in an interview

"I start from the team and the workload, not from the technology. For one or two ASP.NET Core APIs that are always on, App Service is the default: I deploy code or a container, I get deployment slots, autoscale rules, managed TLS, VNet integration and health checks, and nobody has to learn Kubernetes. I pay for the plan, so idle time still costs money.

If the work is event-driven (process a Service Bus message, react to a blob, run every night), I use Azure Functions with the isolated worker model. On the Flex Consumption plan it scales per event and to zero, and it now supports VNet integration. The catch is the execution model: triggers and bindings, cold starts and an HTTP response limit of about 230 seconds through the front end. When the team ships containers and several services, I pick Container Apps. It runs on Kubernetes with KEDA, Envoy and optional Dapr, but Microsoft runs the cluster. I get revisions with traffic splitting, scale rules on HTTP, queue length or CPU, and scale to zero. AKS is for when I need the Kubernetes API itself: custom operators, service meshes, GPU node pools, strict network topology, or dozens of services with a platform team to own upgrades, node images and security patching.

The mistake I see is choosing AKS for a three-service product because it 'scales'. Everything here scales; what differs is who carries the pager for the platform. Moving later is cheap if the app is a container with config from the environment, so I keep that path open and choose the least operations that meet today's needs."


Comparison

App Service Functions (Flex Consumption) Container Apps AKS
Unit you deploy Code or container Functions project (code) Container Containers + manifests
Scaling Rules or automatic, instances Per event, to zero KEDA rules, to zero HPA, KEDA, cluster autoscaler
Pricing Per plan instance (always on) Per execution and memory, optional always-ready Per vCPU/memory second, or dedicated workload profiles Node VMs (+ Standard tier control plane)
Release safety Deployment slots Slots on some plans Revisions with traffic split Rolling, or canary with extra tools
Ops burden Very low Very low Low High (upgrades, nodes, add-ons)
Best for Few web apps and APIs Event-driven, spiky jobs Microservices without a platform team Large estates, special needs

When to move

From → To Trigger
App Service → Container Apps Many small services, want scale to zero or event scaling
Functions → Container Apps Long-running work, custom containers, Functions limits
Container Apps → AKS Need Kubernetes APIs, operators, mesh, custom node pools
AKS → Container Apps Platform work is eating feature time with no special need

Production example

A team running eight internal APIs on four App Service plans in Australia East moved them to one Container Apps environment. Six services were idle outside business hours and scaled to zero, so compute cost dropped by about 40%, while the two customer-facing APIs kept a minimum of two replicas for latency.

🔍 What the interviewer is checking

Checks that the candidate matches the compute option to the workload and team, and understands the cost and operations trade-offs.

Green flags

  • Starts from team skills, number of services and load shape
  • Knows Container Apps runs on Kubernetes with KEDA and revisions
  • Mentions current Functions facts (Flex Consumption, isolated worker)
  • Keeps the app portable so a later move is cheap

Red flags

  • Picks AKS by default "because it scales"
  • Doesn't know the cost model differences
  • Ignores Functions execution limits and cold starts

📚 Learn in depth

1. What each option really is

App Service:     Front end (load balancer) ─▶ worker VMs in your plan ─▶ your app process
Functions:       Scale controller watches triggers ─▶ adds instances ─▶ Functions host + isolated worker
Container Apps:  Envoy ingress ─▶ managed Kubernetes ─▶ your pods; KEDA scales on events
AKS:             Your ingress ─▶ your node pools ─▶ your pods; you own add-ons and upgrades

App Service runs your app on dedicated VMs in a plan; all apps in a plan share them. Functions adds a scale controller that watches trigger sources (queue length, event backlog) and adds instances. Container Apps hides a Kubernetes cluster and exposes apps, revisions and scale rules. AKS gives you the cluster.

2. Cost models

  • Always-on plan (App Service, Functions Premium/Dedicated, Container Apps dedicated profiles): predictable, pays for idle.
  • Per use (Flex Consumption, Container Apps consumption): cheap at low or spiky load, expensive at constant high load.
  • Node VMs (AKS): you pay for capacity and must pack pods well; idle nodes are waste.

A rule of thumb: if a service is busy more than roughly half the day, compare an always-on price; if it idles most of the day, per use usually wins.

3. Functions hosting plans in 2026

  • Flex Consumption: GA, Linux, scale to zero, VNet integration, always-ready instances to cut cold starts, choice of instance memory. The recommended serverless plan.
  • Consumption (Linux): no new features since September 2025 and retiring on 30 September 2028; migrate to Flex.
  • Premium (Elastic Premium): pre-warmed instances, no cold start, always billed.
  • Dedicated: runs on an App Service plan.

Also, the in-process .NET model reached end of support on 10 November 2026, so new and existing .NET function apps should use the isolated worker model on .NET 10.

4. Container Apps internals

An environment is a secure boundary (one VNet, shared Log Analytics). Each app has revisions; you can split traffic 90/10 between revisions for canary releases. Scale rules use KEDA scalers (HTTP concurrency, Service Bus queue length, CPU). Workload profiles let you mix consumption with dedicated VM sizes, including serverless GPUs in Australia East. Jobs run batch or scheduled work to completion.

5. What AKS adds and costs

You get the full API: CRDs, operators, network policies, service meshes, node pools with specific VM sizes, GPU nodes and Windows nodes. You also own Kubernetes version upgrades (about three minor versions a year), node image patching, ingress controllers, certificate management and capacity planning. AKS Automatic reduces some of this, but it is still Kubernetes.

Try it yourself

  1. Deploy the same minimal API container to App Service and to Container Apps; compare the time to first request after idle.
  2. Set a Container Apps scale rule to minReplicas: 0 and watch replicas with az containerapp replica list as you send traffic.
  3. Create a Flex Consumption function app with a Service Bus trigger and watch it scale in Application Insights Live Metrics.
  4. Use the Azure pricing calculator to price 2 vCPU / 4 GiB running 24/7 versus 8 hours a day on each option.

💻 Code

The same .NET 10 container deployed to Container Apps with a queue-based scale rule, using Bicep (managed identity, no connection string):

resource api 'Microsoft.App/containerApps@2024-03-01' = {
  name: 'ca-orders-api'
  location: 'australiaeast'
  identity: { type: 'SystemAssigned' }
  properties: {
    environmentId: env.id
    configuration: {
      ingress: { external: true, targetPort: 8080 }
    }
    template: {
      containers: [
        {
          name: 'api'
          image: 'crordersprod.azurecr.io/orders-api:1.4.2'
          resources: { cpu: json('0.5'), memory: '1Gi' }
        }
      ]
      scale: {
        minReplicas: 0      // scale to zero when idle
        maxReplicas: 10
        rules: [
          {
            name: 'http'
            http: { metadata: { concurrentRequests: '50' } }
          }
        ]
      }
    }
  }
}

The app itself stays platform-neutral, so it can move between App Service, Container Apps and AKS:

var builder = WebApplication.CreateBuilder(args);

// Config comes from environment variables on every platform, so nothing here is host-specific.
builder.Services.AddHealthChecks();

var app = builder.Build();
app.MapHealthChecks("/healthz");
app.MapGet("/orders/{id:int}", (int id) => Results.Ok(new { id, status = "Paid" }));
app.Run();

⚠ Common mistakes

  • Mistake: Choosing AKS for a handful of services. Why it is wrong: Upgrades, node patching and ingress become the team's job and slow delivery. Instead: Use App Service or Container Apps until a real Kubernetes need appears.
  • Mistake: Running a long synchronous HTTP job in a Function. Why it is wrong: HTTP-triggered functions hit the roughly 230-second front-end limit regardless of plan. Instead: Accept the request, queue the work and use Durable Functions or a job.
  • Mistake: Comparing prices at list rate only. Why it is wrong: Per-use pricing at constant load can cost more than a plan, and idle plans waste money. Instead: Model the real load profile in the pricing calculator.
  • Mistake: Starting new function apps on Linux Consumption or the in-process model. Why it is wrong: Linux Consumption is retiring and in-process is out of support since November 2026. Instead: Use Flex Consumption and the isolated worker model on .NET 10.
  • Mistake: Putting many unrelated apps on one App Service plan. Why it is wrong: They share CPU and memory, so one noisy app slows the rest. Instead: Group apps with similar load and criticality, and watch plan CPU.
  • Mistake: Hard-coding host assumptions (file paths, IIS settings). Why it is wrong: It locks the app to one platform. Instead: Build a container that reads config from the environment and exposes health endpoints.

🏛 Senior insight: trade-offs

The decision is mostly about operating cost in people, not compute price. A Kubernetes cluster needs someone who understands upgrades, networking and security; if that person does not exist, AKS is a liability. I also look at the shape of the load: constant traffic favours a plan, spiky or business-hours traffic favours scale to zero, and event backlogs favour KEDA or Functions.

Option When it fits Cost When not to
App Service Few always-on web apps Plan price, minimal ops Many small idle services
Functions Flex Event-driven, bursty Per execution Long-running or chatty APIs
Container Apps Microservices, event scaling Per use or dedicated Need operators, mesh, CRDs
AKS Big estate, platform team Nodes + people No Kubernetes skills in team

I measure the choice afterwards: cost per service per month in Cost Management, p95 latency including cold starts, and hours per month spent on platform work.

🔗 Follow-ups the interviewer may ask

  1. When: Candidate chooses Container Apps or AKS Why: Checks they know how to drain in-flight requests during rolling deploys on Kubernetes
    How to answer

    On SIGTERM, Kubernetes removes the pod from endpoints and signals the container at roughly the same time, but endpoint removal takes a few seconds to reach every node and ingress. So I fail readiness as soon as ApplicationStopping fires and add a preStop sleep of about 5–10 s so routing catches up. I let the host finish in-flight requests within HostOptions.ShutdownTimeout (30 s by default since .NET 8), and keep terminationGracePeriodSeconds longer than the preStop delay plus the shutdown timeout. Background services must honour the stopping token. I verify with a load test during a rolling deploy: zero 5xx.

  2. When: Candidate says config comes from environment variables on every platform Why: Checks they can debug configuration precedence on App Service and Kubernetes
    How to answer

    Start by proving what the process actually sees, not what the portal says. Use a masked GetDebugView(), which lists every key with the provider that won, or log the provider list at start-up, and run printenv in the container.

    The usual causes are:

    • Naming: : in a Linux App Service or Kubernetes variable instead of __; App Service connection strings arriving as SQLAZURECONNSTR_*.
    • Precedence: a JSON file or App Configuration added after the defaults overrides environment variables.
    • Wrong environment: ASPNETCORE_ENVIRONMENT unset, so appsettings.Production.json loads.
    • Timing: environment variables are read once; IOptions<T> never reloads; mounted ConfigMaps update by symlink swap, which file watchers miss.

    The trade-off: configuration layering is flexible, but you must be able to see the final merged result in each environment.

↩ Usually asked after

More in Azure

Last updated 23 Nov 2026.

🌐 Sangam's Webring

⏪ Previous 🏠 Main Next ⏩
💬 Chat with me