AZ-305 Learning Portal
Objective 4.1 40 minhigh priorityvirtual-machinesapp-serviceaksazure-functionscontainer-appsacispot-vmsvmssazure-batch

4.1 — Design Compute Solutions

Select the right Azure compute service for workload requirements — Virtual Machines, App Service, AKS, Container Apps, Azure Functions, and Azure Batch — applying decision frameworks for control, scalability, cost, and operational model.

Concept — What & Why

Azure Compute Service Landscape

Virtual MachinesIaaS compute with full OS-level control. Supports custom software, drivers, specialized workloads, and legacy applications. Requires OS patching, security updates, and infrastructure management. Use when no PaaS alternative satisfies the workload's compatibility or control requirements.Azure App ServiceA fully managed PaaS platform for web applications and APIs. Supports .NET, Java, Node.js, Python, PHP, and container images. App Service Plans define the compute tier. Includes built-in scaling, deployment slots for safe releases, and integration with Application Insights.Azure Kubernetes Service (AKS)Managed Kubernetes for containerized workloads. Microsoft manages the control plane; you manage node pools. Supports multiple node pools, Cluster Autoscaler, Horizontal Pod Autoscaler, private clusters, workload identity, and Azure Container Registry integration. Highest operational complexity among compute options.Azure FunctionsEvent-driven serverless compute. Triggers include HTTP, Timer, Queue, Blob, Cosmos DB change feed, Event Hubs, and Service Bus. Consumption plan: pay-per-execution, auto-scales to zero. Premium plan: pre-warmed instances, VNet integration, no cold start. Best for short-lived, event-triggered workloads.Azure Container AppsServerless container hosting built on Kubernetes (Dapr, KEDA) without exposing Kubernetes complexity. Supports HTTP-triggered scaling, event-driven scaling via KEDA, and Dapr for microservice communication. Positioned between ACI (no orchestration) and AKS (full Kubernetes).

Compute Decision Framework

QuestionYes →No →
Need full OS control?Virtual MachinesContinue
Containerized microservices with Kubernetes control?AKSContinue
Serverless preferred, short-lived or event-driven?Azure Functions or Container AppsContinue
Managed platform for web/API (no containers)?App ServiceContinue
Large-scale parallel/HPC batch processing?Azure BatchVM Scale Sets

Compute Service Comparison

ServiceManagementScalingOrchestrationBest For
Virtual MachinesManual (IaaS)VMSS auto-scaleNoneLegacy, full control
App ServiceManaged (PaaS)Built-in, slot-basedNoneWeb apps, APIs
AKSManaged K8sHPA + Cluster AutoscalerFull KubernetesProduction containers
Container AppsServerlessAuto (KEDA)Managed K8sMicroservices, serverless
ACINoneManualNoneBurst containers, sidecar
Azure FunctionsServerlessAuto to zeroNoneEvent-driven, lightweight
Azure BatchManagedPool auto-scaleJob-basedHPC, rendering, ML
Deep Dive — How It Works

Cost Optimization for Compute

VM Cost Models

OptionDiscountCommitmentBest For
Pay-as-you-goBaselineNoneDev/test, unpredictable
Reserved Instances (1-year)~30–40%1 yearPredictable steady workloads
Reserved Instances (3-year)~50–60%3 yearsLong-term stable workloads
Spot VMsUp to 90%None (evictable)Fault-tolerant batch, testing
Azure Hybrid Benefit40–50%Existing licensesWorkloads with Windows/SQL licenses

Spot VMs are evicted when Azure needs capacity — suitable for stateless batch processing, CI/CD agents, and rendering but NOT for production databases or stateful services.

App Service Tier Selection

TierHACustom DomainDeployment SlotsIsolation
Free/SharedNoNoNoShared
BasicNoYesNoDedicated
StandardYesYes5 slotsDedicated
Premium v3Yes + AZYes20 slotsDedicated
Isolated (ASE)Yes + VNetYes20 slotsFull VNet isolation

Key Rule: Standard tier minimum for production. Premium v3 for availability zone support. App Service Environment (ASE) for compliance requiring full network isolation (PCI, HIPAA).

AKS Architecture Patterns

  • System node pool: Runs Kubernetes core services (coredns, kube-proxy) — dedicated, not evictable
  • User node pools: Run application workloads — can use Spot VMs for cost savings
  • Private cluster: API server in VNet — no public endpoint, required for compliance scenarios

Azure Functions Plan Comparison

PlanCold StartScaleVNetMax Duration
ConsumptionYesAuto to zeroNo (Basic)10 minutes
PremiumNo (pre-warmed)Auto (min instances)YesUnlimited
Dedicated (App Service)NoManual/autoYesUnlimited
Flex ConsumptionMinimalAuto (per-function)YesUnlimited

Consumption Plan = lowest cost, scale to zero, cold start possible. Use for infrequent event-driven tasks. Premium Plan = no cold start, VNet integration. Use when Functions need VNet access to private resources or require guaranteed response time.

Hands-On Lab

Hands-On: Deploy App Service and Configure AKS

Step 1: Create App Service with Deployment Slots

  1. Navigate to App Services > Create
  2. Select runtime stack (.NET, Node.js, Python) and OS
  3. App Service Plan: Standard S1 minimum for slots; Premium v3 for AZ support
  4. Review and create
  5. Go to Deployment > Deployment slots > Add slot (name: staging)
  6. Deploy to staging slot; test application
  7. Click Swap to promote staging to production with zero downtime

Step 2: Create AKS Cluster

  1. Navigate to Kubernetes services > Create
  2. Configure:
    • Kubernetes version: Latest GA
    • Node size: Standard_D2s_v3 (system pool)
    • Node count: 3 (spread across zones)
    • Availability zones: 1, 2, 3
  3. Enable: OIDC Issuer, Workload Identity, Container Insights
  4. Networking: Azure CNI (recommended), private cluster for compliance
  5. Review and create

Step 3: Configure Horizontal Pod Autoscaler (HPA)

  1. Deploy application to AKS
  2. Apply HPA:
    apiVersion: autoscaling/v2
    kind: HorizontalPodAutoscaler
    metadata:
      name: app-hpa
    spec:
      scaleTargetRef:
        apiVersion: apps/v1
        kind: Deployment
        name: my-app
      minReplicas: 2
      maxReplicas: 20
      metrics:
      - type: Resource
        resource:
          name: cpu
          target:
            type: Utilization
            averageUtilization: 70
    
  3. HPA automatically scales pods between 2–20 based on CPU

Step 4: Deploy Azure Functions (Consumption Plan)

  1. Navigate to Function Apps > Create
  2. Hosting plan: Consumption (serverless, pay-per-execution)
  3. Runtime: .NET, Node.js, Python, etc.
  4. Review and create
  5. Add a function with HTTP trigger or Timer trigger
  6. Monitor execution in Application Insights
Exam Angle — What AZ-305 Tests

AZ-305 Exam Focus

AZ-305 tests your ability to select the right compute service for a given workload description. The most frequent question pattern is a scenario description followed by "which Azure service is most appropriate?" — you must apply the decision framework rapidly.

Exam Trap

AKS for All Containers: AKS is not the right answer for every container scenario. ACI (Azure Container Instances) is for single containers with no orchestration need. Container Apps is for serverless container microservices. AKS is for production workloads requiring full Kubernetes control. Recommending AKS for simple container workloads is over-engineering.

Exam Trap

Spot VMs for All Cost Savings: Spot VMs can be evicted with 30-second notice when Azure needs capacity. Never use Spot VMs for production workloads, databases, or stateful services. They are only suitable for fault-tolerant batch processing, CI/CD runners, and rendering pipelines that can restart on eviction.

Exam Trap

Functions Consumption Plan for VNet: Consumption plan Functions cannot connect to VNet-isolated resources (private endpoints, private databases) without additional configuration. Premium plan with VNet integration is required. The exam frequently tests this networking limitation.

Exam Trap

App Service Free/Basic for Production: Free and Basic tiers do not support deployment slots and have no SLA guarantee. Standard tier minimum for production with slots; Premium v3 for availability zone support.

Exam Tip

ACI for Burst Workloads: Azure Container Instances is the answer for supplemental burst compute with AKS (virtual nodes), one-off container jobs without orchestration, and sidecar containers for testing. It starts instantly with no infrastructure management but has no auto-scaling or orchestration.

Must Memorize

Compute Selection Summary: Legacy/custom OS → VM. Web/API managed → App Service. Containerized production Kubernetes → AKS. Serverless containers/microservices → Container Apps. Event-driven/lightweight → Functions. HPC/batch → Azure Batch. Each service occupies a distinct niche in the decision tree.

Question — click to flip

Q: When should you choose AKS over Azure Container Apps for a containerized microservices workload?

Question — click to flip

Q: What is the difference between Azure Functions Consumption plan and Premium plan?

Question — click to flip

Q: When are Spot VMs appropriate and when should they never be used?

Question — click to flip

Q: What App Service tier is minimum for production workloads with zero-downtime deployments?

Question — click to flip

Q: A company wants to migrate a legacy Windows application that requires specific OS drivers and custom registry settings. Which compute service is appropriate?

Question — click to flip

Q: Azure Batch is the answer for which type of workload?

Sources & Further Reading