1---2name: azure-architecture-patterns3description: Well-Architected Framework principles and Azure best practices4---56# Azure Architecture Patterns78> Well-Architected Framework principles, reference architectures, and Azure best practices.910## The Five Pillars1112| Pillar | Focus | Key Question |13|--------|-------|--------------|14| Reliability | Resiliency, availability | Will it stay up? |15| Security | Protection, compliance | Is it safe? |16| Cost Optimization | Efficiency, value | Is it worth it? |17| Operational Excellence | Manageability, observability | Can we run it? |18| Performance Efficiency | Scalability, responsiveness | Is it fast enough? |1920## Reliability Patterns2122### Key Patterns2324- **Circuit Breaker**: Fail fast when downstream unhealthy (Polly)25- **Retry with Backoff**: Handle transient failures with exponential delays26- **Availability Zones**: Distribute across datacenters2728### Reliability Checklist2930- [ ] Single points of failure identified and mitigated31- [ ] Health endpoints implemented (`/health`, `/ready`)32- [ ] Retry policies with backoff33- [ ] Circuit breakers for external dependencies34- [ ] Availability zones utilized35- [ ] RTO/RPO defined and tested3637## Security Patterns3839### Zero Trust4041| Principle | Implementation |42|-----------|----------------|43| Verify explicitly | Always authenticate/authorize |44| Least privilege | Minimal necessary permissions |45| Assume breach | Segment, encrypt, detect |4647### Identity4849- **Managed Identity**: Eliminate credential management50- **RBAC**: Built-in roles, scope to resource group, use groups5152### Network5354- **Private Endpoints**: Keep traffic on Azure backbone55- **NSG**: Default deny, explicit allow (priority 100-4096)5657### Security Checklist5859- [ ] Managed identities (no stored credentials)60- [ ] Key Vault for secrets/certificates61- [ ] Private endpoints for PaaS services62- [ ] NSG rules deny-by-default63- [ ] TLS 1.2+ enforced64- [ ] Microsoft Defender enabled6566## Cost Optimization6768| Strategy | Impact |69|----------|--------|70| Right-size | Match SKU to workload |71| Reserved Instances | 40-72% savings |72| Spot VMs | 90% discount (interruptible) |73| Auto-shutdown | Dev/test off at night |74| Serverless | Pay per execution |7576### Compute Selection7778| Workload | Recommended |79|----------|-------------|80| Steady-state web | App Service Premium |81| Event-driven | Azure Functions |82| Batch processing | Container Apps + KEDA |83| Big compute | Spot VMs + Batch |84| Dev/test | B-series VMs |8586### Storage Tiers8788| Tier | Use Case | Cost |89|------|----------|------|90| Hot | Frequent access | ~$0.02/GB |91| Cool | Infrequent (30+ days) | ~$0.01/GB |92| Archive | Rarely accessed | ~$0.002/GB |9394### Cost Checklist9596- [ ] Azure Advisor recommendations reviewed97- [ ] Reserved Instances for predictable workloads98- [ ] Auto-shutdown for non-prod99- [ ] Right-sized based on utilization100- [ ] Storage lifecycle policies101- [ ] Cost alerts and budgets set102103## Operational Excellence104105### IaC Tools106107| Tool | Best For |108|------|----------|109| Bicep | Azure-native, declarative |110| Terraform | Multi-cloud, state management |111| ARM | Legacy (avoid for new) |112113### Observability Stack114115| Layer | Service |116|-------|---------|117| Logs | Log Analytics |118| Metrics | Azure Monitor |119| Traces | Application Insights |120| Alerts | Azure Alerts |121| Dashboards | Azure Workbooks |122123### Operational Checklist124125- [ ] IaC for all resources (Bicep/Terraform)126- [ ] CI/CD pipelines for deployment127- [ ] Diagnostic settings to Log Analytics128- [ ] Application Insights integrated129- [ ] Alerts for critical metrics130131## Performance Efficiency132133### Scalability134135| Service | Mechanism |136|---------|-----------|137| App Service | Autoscale rules |138| Azure Functions | Event-driven automatic |139| AKS | HPA + Cluster Autoscaler |140| VMSS | Autoscale rules |141142### Caching Strategy143144| Type | Use Case | Service |145|------|----------|---------|146| CDN | Static content | Azure Front Door |147| Distributed | Session, computed | Redis Cache |148| Local | Hot data | In-memory |149150### Performance Checklist151152- [ ] Autoscaling configured and tested153- [ ] CDN for static content154- [ ] Redis cache for hot data155- [ ] Database indexes reviewed156- [ ] Load testing completed157158## Reference Architectures159160### Web Application161```162Internet → Front Door → App Service → Azure SQL + Redis163```164165### Microservices166```167Internet → API Management → AKS → Cosmos DB + Service Bus168```169170### Serverless171```172Events → Event Grid → Functions → Cosmos DB + Storage173```174175## SKU Selection176177| Series | Use Case |178|--------|----------|179| B-series | Dev/test (burstable) |180| D-series | Most production |181| E-series | Memory-optimized |182| F-series | Compute-optimized |183184## Anti-Patterns185186| Anti-Pattern | Fix |187|--------------|-----|188| Monolithic deployment | Microservices or modular |189| Hardcoded config | App Configuration, Key Vault |190| Single region | Multi-region + Traffic Manager |191| Over-provisioned | Right-size + autoscale |192| No IaC | Bicep/Terraform everything |193194## MCP Tools Available195196| Tool | Use Case |197|------|----------|198| `mcp_azure_mcp_cloudarchitect` | Interactive architecture design |199| `mcp_azure_mcp_documentation` | Search Azure docs |200| `mcp_azure_mcp_get_bestpractices` | Code gen, deployment patterns |201| Service-specific tools | AKS, App Service, Functions, Cosmos, SQL |