βΆAzure Functions vs AWS Lambda vs Google Cloud Functions, which should I use?
Azure: best for .NET/C# shops with existing Azure infrastructure and Durable Functions for complex workflows. AWS Lambda: most mature, largest community, deepest AWS ecosystem integration, cheapest at scale. Google Cloud Functions: clean API, good for GCP-heavy teams, less mature than Lambda. For new projects: Lambda if AWS-first, Cloud Functions if GCP, Azure Functions if .NET or Microsoft cloud.
βΆConsumption plan vs Premium plan, when do I choose?
Consumption: pay-per-invocation, starts from zero, cold starts 1-5s (V1) or <1s (V4), no VNet. Premium: fixed monthly cost, always warm, VNet integration, better for sustained traffic or VNet-dependent workloads. Flex Consumption (2024+) bridges the gap: consumption pricing with better cold starts and networking. For APIs under 100k invocations/month: consumption. For 1M+/month or latency-sensitive: premium. VNet requirement: premium or Flex.
βΆWhat are Durable Functions and when should I use them?
Durable Functions extends Azure Functions with stateful orchestration: function chaining, fan-out/fan-in, human approvals, async workflows. Use for multi-step business processes (order β payment β fulfillment β notification), complex sagas, and long-running operations. Durable Entities maintain state across calls. Without Durable Functions you'd need Step Functions equivalent or external state store. Adds 10-15% complexity but eliminates massive plumbing.
βΆHow do cold starts compare to Lambda, and how do I minimize them?
Azure Functions V4: <1s cold start on premium plan (competitive with Lambda SnapStart). Consumption plan: 1-5s on first invocation. Minimize: use premium plan or Flex Consumption, keep function package small, use lightweight bindings, prefer C# over Python for startup time. Application Insights shows cold start duration separately. For latency-SLA <500ms: use premium plan or pre-warm with timer triggers.
βΆHow do I deploy Azure Functions, Azure Portal, CLI, Bicep, Terraform, or IaC?
Never portal for production. Azure CLI: `func azure functionapp publish` is simplest for small projects. Bicep: Azure-native IaC, YAML-like, good for template-heavy orgs. Terraform: multi-cloud, mature, larger state. Azure DevOps Pipelines: tight integration if already using ADO. For new projects: Terraform or Bicep depending on team expertise. CI/CD: GitHub Actions or Azure Pipelines both work.
βΆHow do I monitor and debug Azure Functions?
Application Insights is the standard (built-in integration). Logs appear in Azure Portal and Application Insights portal. Enable distributed tracing, dependency tracking, custom metrics. Application Insights shows cold starts, invocation count, errors, duration p50/p95/p99. CloudWatch alternative: none (you're locked into Azure). Set alerts on error rate, execution time, throttles. ILogger in code goes straight to App Insights.
βΆService Bus vs Event Grid vs Queue Storage triggers, when do I use which?
Queue Storage: simple FIFO, built-in, cheap, good for background jobs. Service Bus: more features (dead lettering, sessions, deduplication), enterprise-grade messaging, queues+topics. Event Grid: event distribution (publish-subscribe), low-latency, good for reactive workflows. Function pattern: HTTP trigger for APIs, Service Bus for async command processing, Event Grid for events from Azure resources, Queue for simple jobs. Use Service Bus if you need guaranteed delivery + DLQ.