Azure Compute
Choose the compute option with the lowest operational burden that meets your workload's functional and non-functional requirements.
Managed services first; IaaS only when control is mandatory.
Use This Skill When
- The user asks which Azure compute service to use (Functions vs. App Service vs. AKS)
- A workload must move from on-premises or another cloud to Azure
- The user needs trade-off analysis: cost, scaling, latency, compliance
- The user needs operational readiness assessment
Context: Compute Maturity Spectrum
Serverless (Least ops):
Azure Functions
└─ Pro: Zero infrastructure, auto-scale, pay-per-exec
└─ Con: Cold starts, max 10-min timeout, limited languages
PaaS (Low ops):
App Service
└─ Pro: Built-in scaling, diagnostics, deployment slots
└─ Con: Single-region, limited customization
Container Apps
└─ Pro: Container-native, auto-scaling, event-driven
└─ Con: Smaller ecosystem, newer service
Containers + Orchestration:
Azure Kubernetes Service (AKS)
└─ Pro: Full Kubernetes control, multi-region, custom scaling
└─ Con: Requires Kubernetes expertise, higher operational burden
IaaS (Most control, Most ops):
Virtual Machines / VMSS
└─ Pro: OS-level control, custom binaries, legacy support
└─ Con: Requires manual patching, scaling, monitoring
Required Inputs
- Workload type: Web API, background job, ML training, legacy app, real-time analytics
- Traffic pattern: Constant, bursty, seasonal, event-driven
- Latency requirement: Sub-100ms, <500ms, or flexible
- Availability: 99%, 99.9%, 99.95%?
- Scaling needs: Min/max instances, target response time
- Compliance: On-premises only, specific regions, data residency
- Team skills: DevOps, Kubernetes expertise, vendor lock-in tolerance
- Budget: TCO vs. OpEx preference
Decision Tree
Is this a background job triggered by an event (file upload, message queue, timer)?
├─ Yes → Azure Functions (lowest cost, auto-scale, easy)
│ But if: Job runs >10 min → Container Apps or App Service
└─ No → Continue
Is this a stateless HTTP API or web app?
├─ Yes → App Service (built-in scaling, diagnostics)
│ Or: Container Apps (if containerized, multi-region)
├─ Needs Kubernetes → AKS
└─ No → Continue
Does this need OS-level control (custom packages, specific kernel version)?
├─ Yes → Virtual Machines or VMSS
└─ No → One of above managed options
Is latency critical (< 100ms p99)?
├─ Yes → Consider colocating compute with data store (same region/AZ)
│ Evaluate: App Service Plan, VMSS, or Container Apps with CPU optimization
└─ No → Standard deployment acceptable
Do you need to orchestrate multiple microservices?
├─ Yes → AKS (service mesh, traffic mgmt, multi-region)
│ Or: App Service + API Management (simpler, less overhead)
└─ No → Single-service option (Functions, App Service)
Workflow
Phase 1: Characterize Workload
Inventory current state:
- Runtime: Node.js, Python, .NET, Java, Go, etc.
- Concurrency: Single-threaded, multi-threaded, async?
- State: Stateless, session affinity, distributed cache?
- Dependencies: Database, message queue, cache, external APIs?
- Constraints: Max execution time, memory, disk I/O?
Predict load profile:
- Baseline (off-peak): 10 req/sec
- Average (peak): 100 req/sec
- Spike (flash sale, viral event): 500 req/sec
- Duration of spikes: Seconds or hours?
Define SLA:
- Availability: 99% (5.2 hours downtime/month) vs. 99.95% (21 minutes/month)
- Response time p99: Must be <500ms? <100ms?
- Cost sensitivity: $500/month budget or flexible?
Phase 2: Evaluate Candidates
Candidate 1: Azure Functions
✓ Event-driven, API-triggered, timer-based workloads
✓ Zero infrastructure, auto-scale to thousands
✓ Pay only for execution time
✗ Cold starts (first invocation 1-5 sec)
✗ Max 10-minute execution timeout
✗ Limited to 1.5 GB memory per invocation
✗ Not suitable for stateful or long-running tasks
Cost estimate: 1M invocations/month × $0.20/1M = $0.20 + compute duration charges
Candidate 2: App Service
✓ Web APIs, web apps, long-running services
✓ Instant startup (no cold start)
✓ Built-in auto-scale, deployment slots
✓ Integrated diagnostics, backups
✗ Single region (unless you manage multi-region)
✗ Always-on instances (minimum cost even at 0 traffic)
Cost estimate: P1V2 plan (1 core, 1.75 GB) = $74/month × 2 instances = $148/month
Candidate 3: Container Apps
✓ Containerized microservices, event-scale
✓ Auto-scale to zero (similar to Functions)
✓ Multi-region deployment
✗ Newer service, smaller ecosystem
✗ Kubernetes learning curve
Cost estimate: 0.5 vCPU, 1 GB memory, auto-scale = ~$30-50/month
Candidate 4: AKS
✓ Complex microservices orchestration
✓ Service mesh, traffic mgmt, canary deployments
✓ Multi-region, high availability
✓ Kubernetes portability
✗ Requires Kubernetes expertise
✗ Significant operational overhead
✗ Higher minimum cost (node pool)
Cost estimate: 3-node cluster (B2S VMs) = $30/month × 3 + storage + egress = $100-200/month+
Candidate 5: Virtual Machines
✓ Legacy app, custom OS packages, GPL software
✓ OS-level control
✗ Manual scaling, patching, monitoring
✗ Highest operational burden
✗ Highest minimum cost
Cost estimate: D2s_v3 VM = $97/month × 2 (HA) = $194/month minimum
Phase 3: Size and Scale
Baseline sizing (off-peak):
- Functions: $5-10/month (very low)
- App Service: 1 instance × plan cost (~$50/month)
- Container Apps: 0.25 vCPU (~$10/month)
- AKS: 2-3 node minimum (~$100-150/month)
- VMs: 2 instances (HA) (~$200/month)
Scaling policy:
- Functions: Auto, no configuration needed
- App Service: Auto-scale rule: 50-80 CPU%, scale out when >80%, scale in when <30%
- Container Apps: CPU 70%, memory 80%
- AKS: Kubernetes HPA: target CPU 70%
- VMs/VMSS: Scale set: CPU 70%, add 2 instances at a time
Cost impact of scaling:
- Functions: $0.20 per 1M invocations + duration
- App Service: +$74/month per standard instance
- Container Apps: +$30-50/month per scaled instance
- AKS: +$30/month per node
Output Contract
Recommended Compute Option
- Why this option is best for your workload
- Confidence level (80%, 95%, etc.)
Justification & Trade-Offs
- Operational burden vs. cost vs. flexibility
- Why alternatives were rejected
Sizing & Scaling
- Baseline instance count, VM size
- Auto-scale rules (CPU/memory thresholds)
- Peak capacity and estimated cost
Cold Start & Latency Impact
- If Functions: ~1-5 sec cold start time, 100 ms warm
- Mitigation: Keep-alive, premium plan, container warm-up
Operational Checklist
- Monitoring (Application Insights)
- Logging (Log Analytics)
- Backup/DR strategy
- CI/CD pipeline type
Migration Readiness
- Dependency adjustments (connection strings, auth)
- Testing strategy (smoke, integration, load)
- Rollback plan (old platform stays active until validated)
Practical Examples
Example 1: Bursty Event-Driven Workload
Workload: Image resize triggered on file upload to blob storage
- Traffic: 10 images/day (steady), 1000 images/day on marketing campaign (spiky)
- Latency: <30 sec acceptable (async)
- Recommendation: Azure Functions (Premium Plan for concurrency control)
- Cost: ~$40/month steady + $0.20 per 1M invocations
Example 2: Steady HTTP API
Workload: REST API for mobile app
- Traffic: 100 req/sec average, 500 req/sec peak
- Latency: <100ms p99 (critical)
- Availability: 99.95%
- Recommendation: App Service P1V2 (2+ instances) + CDN for static assets
- Cost: $148/month (2 instances) + egress
Example 3: Microservices Architecture
Workload: 5 services: API gateway, auth, billing, inventory, notifications
- Need service-to-service communication, canary deployments
- Team: Kubernetes-experienced DevOps team
- Recommendation: AKS with Helm charts, Istio service mesh
- Cost: $100-150/month (3-node cluster) + storage, egress
Guardrails
- Avoid over-engineering: Use Functions for simple tasks; don't add AKS until you need it.
- Be honest about operational burden: AKS requires dedicated DevOps; App Service works with dev teams.
- Consider lock-in: App Service is Azure-only; AKS is portable (but requires Kubernetes skills).
- Latency matters: Functions cold starts may violate SLA; test realistic load.
- Monitor from day one: Set up alerts before go-live (CPU, memory, errors, latency).
- Plan for growth: Today's App Service might become tomorrow's AKS; design for portability.
1---2name: azure-compute3description: Select and implement the right Azure compute platform for a workload. Decision tree guides choice based on workload characteristics, scaling needs, and operational maturity. Covers serverless, PaaS, containers, Kubernetes, and IaaS patterns.4---56# Azure Compute78Choose the compute option with the lowest operational burden that meets your workload's functional and non-functional requirements.9Managed services first; IaaS only when control is mandatory.1011## Use This Skill When1213- The user asks which Azure compute service to use (Functions vs. App Service vs. AKS)14- A workload must move from on-premises or another cloud to Azure15- The user needs trade-off analysis: cost, scaling, latency, compliance16- The user needs operational readiness assessment1718## Context: Compute Maturity Spectrum1920```21Serverless (Least ops):22 Azure Functions23 └─ Pro: Zero infrastructure, auto-scale, pay-per-exec24 └─ Con: Cold starts, max 10-min timeout, limited languages2526PaaS (Low ops):27 App Service28 └─ Pro: Built-in scaling, diagnostics, deployment slots29 └─ Con: Single-region, limited customization30 31 Container Apps32 └─ Pro: Container-native, auto-scaling, event-driven33 └─ Con: Smaller ecosystem, newer service3435Containers + Orchestration:36 Azure Kubernetes Service (AKS)37 └─ Pro: Full Kubernetes control, multi-region, custom scaling38 └─ Con: Requires Kubernetes expertise, higher operational burden3940IaaS (Most control, Most ops):41 Virtual Machines / VMSS42 └─ Pro: OS-level control, custom binaries, legacy support43 └─ Con: Requires manual patching, scaling, monitoring44```4546## Required Inputs4748- **Workload type**: Web API, background job, ML training, legacy app, real-time analytics49- **Traffic pattern**: Constant, bursty, seasonal, event-driven50- **Latency requirement**: Sub-100ms, <500ms, or flexible51- **Availability**: 99%, 99.9%, 99.95%?52- **Scaling needs**: Min/max instances, target response time53- **Compliance**: On-premises only, specific regions, data residency54- **Team skills**: DevOps, Kubernetes expertise, vendor lock-in tolerance55- **Budget**: TCO vs. OpEx preference5657## Decision Tree5859```60Is this a background job triggered by an event (file upload, message queue, timer)?61├─ Yes → Azure Functions (lowest cost, auto-scale, easy)62│ But if: Job runs >10 min → Container Apps or App Service63└─ No → Continue6465Is this a stateless HTTP API or web app?66├─ Yes → App Service (built-in scaling, diagnostics)67│ Or: Container Apps (if containerized, multi-region)68├─ Needs Kubernetes → AKS69└─ No → Continue7071Does this need OS-level control (custom packages, specific kernel version)?72├─ Yes → Virtual Machines or VMSS73└─ No → One of above managed options7475Is latency critical (< 100ms p99)?76├─ Yes → Consider colocating compute with data store (same region/AZ)77│ Evaluate: App Service Plan, VMSS, or Container Apps with CPU optimization78└─ No → Standard deployment acceptable7980Do you need to orchestrate multiple microservices?81├─ Yes → AKS (service mesh, traffic mgmt, multi-region)82│ Or: App Service + API Management (simpler, less overhead)83└─ No → Single-service option (Functions, App Service)84```8586## Workflow8788### Phase 1: Characterize Workload89901. **Inventory current state**:91 - Runtime: Node.js, Python, .NET, Java, Go, etc.92 - Concurrency: Single-threaded, multi-threaded, async?93 - State: Stateless, session affinity, distributed cache?94 - Dependencies: Database, message queue, cache, external APIs?95 - Constraints: Max execution time, memory, disk I/O?96972. **Predict load profile**:98 - Baseline (off-peak): 10 req/sec99 - Average (peak): 100 req/sec100 - Spike (flash sale, viral event): 500 req/sec101 - Duration of spikes: Seconds or hours?1021033. **Define SLA**:104 - Availability: 99% (5.2 hours downtime/month) vs. 99.95% (21 minutes/month)105 - Response time p99: Must be <500ms? <100ms?106 - Cost sensitivity: $500/month budget or flexible?107108### Phase 2: Evaluate Candidates109110**Candidate 1: Azure Functions**111```112✓ Event-driven, API-triggered, timer-based workloads113✓ Zero infrastructure, auto-scale to thousands114✓ Pay only for execution time115✗ Cold starts (first invocation 1-5 sec)116✗ Max 10-minute execution timeout117✗ Limited to 1.5 GB memory per invocation118✗ Not suitable for stateful or long-running tasks119120Cost estimate: 1M invocations/month × $0.20/1M = $0.20 + compute duration charges121```122123**Candidate 2: App Service**124```125✓ Web APIs, web apps, long-running services126✓ Instant startup (no cold start)127✓ Built-in auto-scale, deployment slots128✓ Integrated diagnostics, backups129✗ Single region (unless you manage multi-region)130✗ Always-on instances (minimum cost even at 0 traffic)131132Cost estimate: P1V2 plan (1 core, 1.75 GB) = $74/month × 2 instances = $148/month133```134135**Candidate 3: Container Apps**136```137✓ Containerized microservices, event-scale138✓ Auto-scale to zero (similar to Functions)139✓ Multi-region deployment140✗ Newer service, smaller ecosystem141✗ Kubernetes learning curve142143Cost estimate: 0.5 vCPU, 1 GB memory, auto-scale = ~$30-50/month144```145146**Candidate 4: AKS**147```148✓ Complex microservices orchestration149✓ Service mesh, traffic mgmt, canary deployments150✓ Multi-region, high availability151✓ Kubernetes portability152✗ Requires Kubernetes expertise153✗ Significant operational overhead154✗ Higher minimum cost (node pool)155156Cost estimate: 3-node cluster (B2S VMs) = $30/month × 3 + storage + egress = $100-200/month+157```158159**Candidate 5: Virtual Machines**160```161✓ Legacy app, custom OS packages, GPL software162✓ OS-level control163✗ Manual scaling, patching, monitoring164✗ Highest operational burden165✗ Highest minimum cost166167Cost estimate: D2s_v3 VM = $97/month × 2 (HA) = $194/month minimum168```169170### Phase 3: Size and Scale1711721. **Baseline sizing** (off-peak):173 - Functions: $5-10/month (very low)174 - App Service: 1 instance × plan cost (~$50/month)175 - Container Apps: 0.25 vCPU (~$10/month)176 - AKS: 2-3 node minimum (~$100-150/month)177 - VMs: 2 instances (HA) (~$200/month)1781792. **Scaling policy**:180 - **Functions**: Auto, no configuration needed181 - **App Service**: Auto-scale rule: 50-80 CPU%, scale out when >80%, scale in when <30%182 - **Container Apps**: CPU 70%, memory 80%183 - **AKS**: Kubernetes HPA: target CPU 70%184 - **VMs/VMSS**: Scale set: CPU 70%, add 2 instances at a time1851863. **Cost impact of scaling**:187 - Functions: $0.20 per 1M invocations + duration188 - App Service: +$74/month per standard instance189 - Container Apps: +$30-50/month per scaled instance190 - AKS: +$30/month per node191192## Output Contract1931941. **Recommended Compute Option**195 - Why this option is best for your workload196 - Confidence level (80%, 95%, etc.)1971982. **Justification & Trade-Offs**199 - Operational burden vs. cost vs. flexibility200 - Why alternatives were rejected2012023. **Sizing & Scaling**203 - Baseline instance count, VM size204 - Auto-scale rules (CPU/memory thresholds)205 - Peak capacity and estimated cost2062074. **Cold Start & Latency Impact**208 - If Functions: ~1-5 sec cold start time, 100 ms warm209 - Mitigation: Keep-alive, premium plan, container warm-up2102115. **Operational Checklist**212 - Monitoring (Application Insights)213 - Logging (Log Analytics)214 - Backup/DR strategy215 - CI/CD pipeline type2162176. **Migration Readiness**218 - Dependency adjustments (connection strings, auth)219 - Testing strategy (smoke, integration, load)220 - Rollback plan (old platform stays active until validated)221222## Practical Examples223224### Example 1: Bursty Event-Driven Workload225**Workload**: Image resize triggered on file upload to blob storage226- Traffic: 10 images/day (steady), 1000 images/day on marketing campaign (spiky)227- Latency: <30 sec acceptable (async)228- **Recommendation**: Azure Functions (Premium Plan for concurrency control)229- **Cost**: ~$40/month steady + $0.20 per 1M invocations230231### Example 2: Steady HTTP API232**Workload**: REST API for mobile app233- Traffic: 100 req/sec average, 500 req/sec peak234- Latency: <100ms p99 (critical)235- Availability: 99.95%236- **Recommendation**: App Service P1V2 (2+ instances) + CDN for static assets237- **Cost**: $148/month (2 instances) + egress238239### Example 3: Microservices Architecture240**Workload**: 5 services: API gateway, auth, billing, inventory, notifications241- Need service-to-service communication, canary deployments242- Team: Kubernetes-experienced DevOps team243- **Recommendation**: AKS with Helm charts, Istio service mesh244- **Cost**: $100-150/month (3-node cluster) + storage, egress245246## Guardrails247248- **Avoid over-engineering**: Use Functions for simple tasks; don't add AKS until you need it.249- **Be honest about operational burden**: AKS requires dedicated DevOps; App Service works with dev teams.250- **Consider lock-in**: App Service is Azure-only; AKS is portable (but requires Kubernetes skills).251- **Latency matters**: Functions cold starts may violate SLA; test realistic load.252- **Monitor from day one**: Set up alerts before go-live (CPU, memory, errors, latency).253- **Plan for growth**: Today's App Service might become tomorrow's AKS; design for portability.