|
| 1 | +# Azure Deployment Plan |
| 2 | + |
| 3 | +> **Status:** Planning |
| 4 | +
|
| 5 | +Generated: 2026-04-14 |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## 1. Project Overview |
| 10 | + |
| 11 | +**Goal:** Create and deploy a new production Node.js/TypeScript web application on Azure VMSS with Azure SQL backend, autoscaling, and Application Gateway load balancing. |
| 12 | + |
| 13 | +**Path:** New Project |
| 14 | + |
| 15 | +--- |
| 16 | + |
| 17 | +## 2. Requirements |
| 18 | + |
| 19 | +| Attribute | Value | |
| 20 | +|-----------|-------| |
| 21 | +| Classification | Production | |
| 22 | +| Scale | Large (high traffic, autoscaling) | |
| 23 | +| Budget | Balanced | |
| 24 | +| **Subscription** | Playground - 01 (`4b0a7581-9eea-4d30-a166-f8fac23b6edd`) | |
| 25 | +| **Location** | East US | |
| 26 | +| OS | Linux (Ubuntu) | |
| 27 | +| VM Size | Standard_D4s_v5 (4 vCPUs, 16 GB RAM) | |
| 28 | +| Hosting Model | VMSS (Flexible orchestration) | |
| 29 | + |
| 30 | +--- |
| 31 | + |
| 32 | +## 3. Components Detected |
| 33 | + |
| 34 | +| Component | Type | Technology | Path | |
| 35 | +|-----------|------|------------|------| |
| 36 | +| Web App | SSR Web Server | Node.js / TypeScript / Express | `src/web/` | |
| 37 | +| Database | Relational DB | Azure SQL | (managed service) | |
| 38 | + |
| 39 | +--- |
| 40 | + |
| 41 | +## 4. Recipe Selection |
| 42 | + |
| 43 | +**Selected:** Bicep |
| 44 | + |
| 45 | +**Rationale:** User preference for native Azure IaC. Bicep provides first-class ARM integration, strong typing, and is ideal for VMSS + networking + SQL deployments. |
| 46 | + |
| 47 | +--- |
| 48 | + |
| 49 | +## 5. Architecture |
| 50 | + |
| 51 | +**Stack:** VMSS (Virtual Machine Scale Set) + Azure SQL |
| 52 | + |
| 53 | +### Service Mapping |
| 54 | + |
| 55 | +| Component | Azure Service | SKU / Config | |
| 56 | +|-----------|---------------|--------------| |
| 57 | +| Web App (VMSS) | Microsoft.Compute/virtualMachineScaleSets | Standard_D4s_v5, Flexible orchestration, 2–6 instances | |
| 58 | +| Load Balancer | Microsoft.Network/applicationGateways | Application Gateway v2 (L7, TLS offload) | |
| 59 | +| Database | Microsoft.Sql/servers + databases | Azure SQL S2 (50 DTU) | |
| 60 | +| Virtual Network | Microsoft.Network/virtualNetworks | /16 VNet with subnets for VMSS, AppGW, SQL | |
| 61 | +| NSG | Microsoft.Network/networkSecurityGroups | Allow HTTP/HTTPS inbound, restrict SSH | |
| 62 | +| Public IP | Microsoft.Network/publicIPAddresses | Standard SKU, static, for AppGW frontend | |
| 63 | + |
| 64 | +### Supporting Services |
| 65 | + |
| 66 | +| Service | Purpose | |
| 67 | +|---------|---------| |
| 68 | +| Log Analytics | Centralized logging | |
| 69 | +| Application Insights | Monitoring & APM | |
| 70 | +| Key Vault | Secrets management (DB connection string) | |
| 71 | +| Managed Identity | VMSS-to-SQL and VMSS-to-KeyVault auth | |
| 72 | + |
| 73 | +### Autoscale Configuration |
| 74 | + |
| 75 | +| Setting | Value | |
| 76 | +|---------|-------| |
| 77 | +| Metric | CPU percentage | |
| 78 | +| Scale-out threshold | 70% avg CPU for 5 min | |
| 79 | +| Scale-in threshold | 30% avg CPU for 10 min | |
| 80 | +| Min instances | 2 | |
| 81 | +| Max instances | 6 | |
| 82 | +| Cooldown | 5 minutes | |
| 83 | + |
| 84 | +### Network Architecture |
| 85 | + |
| 86 | +``` |
| 87 | +Internet → Public IP → Application Gateway (L7/TLS) → VMSS Subnet → VM instances |
| 88 | + ↓ |
| 89 | + SQL Private Endpoint |
| 90 | +``` |
| 91 | + |
| 92 | +--- |
| 93 | + |
| 94 | +## 6. Provisioning Limit Checklist |
| 95 | + |
| 96 | +### Resource Inventory & Quota Validation |
| 97 | + |
| 98 | +| Resource Type | Number to Deploy | Total After Deployment | Limit/Quota | Notes | |
| 99 | +|---------------|------------------|------------------------|-------------|-------| |
| 100 | +| Microsoft.Compute vCPUs (standardDSv5Family) | 24 (6×4 max) | 24 | 350 | ✅ Fetched from: az vm list-usage | |
| 101 | +| Microsoft.Compute vCPUs (Total Regional) | 24 | 180 | 350 | ✅ Fetched from: az vm list-usage | |
| 102 | +| Microsoft.Compute/virtualMachines | 6 (max) | 47 | 25,000 | ✅ Fetched from: az vm list-usage | |
| 103 | +| Microsoft.Network/virtualNetworks | 1 | 62 | 1,000 | ✅ Fetched from: az network list-usages | |
| 104 | +| Microsoft.Network/publicIPAddresses | 1 | 70 | 1,000 | ✅ Fetched from: az network list-usages | |
| 105 | +| Microsoft.Network/networkSecurityGroups | 2 | 216 | 5,000 | ✅ Fetched from: az network list-usages | |
| 106 | +| Microsoft.Network/loadBalancers (Standard) | 1 (AppGW) | 49 | 1,000 | ✅ Fetched from: az network list-usages | |
| 107 | +| Microsoft.Sql/servers | 1 | 2 | 20 per region | ✅ Fetched from: Azure Resource Graph + official docs | |
| 108 | +| Microsoft.KeyVault/vaults | 1 | ~1 | 10,000 per region | ✅ Fetched from: official docs | |
| 109 | +| Microsoft.OperationalInsights/workspaces | 1 | ~1 | 50 per region | ✅ Fetched from: official docs | |
| 110 | + |
| 111 | +**Status:** ✅ All resources within limits |
| 112 | + |
| 113 | +--- |
| 114 | + |
| 115 | +## 7. Execution Checklist |
| 116 | + |
| 117 | +### Phase 1: Planning |
| 118 | +- [x] Analyze workspace (new project) |
| 119 | +- [x] Gather requirements (production, large, balanced, Linux) |
| 120 | +- [x] Confirm subscription and location with user (Playground - 01, eastus) |
| 121 | +- [x] Prepare resource inventory |
| 122 | +- [x] Fetch quotas and validate capacity |
| 123 | +- [x] Scan codebase (N/A — new project) |
| 124 | +- [x] Select recipe (Bicep) |
| 125 | +- [x] Plan architecture (VMSS + AppGW + SQL) |
| 126 | +- [ ] **User approved this plan** |
| 127 | + |
| 128 | +### Phase 2: Execution |
| 129 | +- [ ] Research components (load Bicep references) |
| 130 | +- [ ] Generate infrastructure files (`infra/main.bicep`, modules) |
| 131 | +- [ ] Generate application code (`src/web/` — Express/TypeScript app) |
| 132 | +- [ ] Generate custom-data script (cloud-init to bootstrap Node.js on VMs) |
| 133 | +- [ ] Generate application configuration |
| 134 | +- [ ] Apply security hardening (NSG rules, Key Vault, managed identity) |
| 135 | +- [ ] ⛔ Update plan status to "Ready for Validation" |
| 136 | + |
| 137 | +### Phase 3: Validation |
| 138 | +- [ ] Invoke azure-validate skill |
| 139 | +- [ ] All validation checks pass |
| 140 | +- [ ] Update plan status to "Validated" |
| 141 | + |
| 142 | +### Phase 4: Deployment |
| 143 | +- [ ] Invoke azure-deploy skill |
| 144 | +- [ ] Deployment successful |
| 145 | +- [ ] Report deployed endpoint URLs |
| 146 | +- [ ] Update plan status to "Deployed" |
| 147 | + |
| 148 | +--- |
| 149 | + |
| 150 | +## 8. Files to Generate |
| 151 | + |
| 152 | +| File | Purpose | Status | |
| 153 | +|------|---------|--------| |
| 154 | +| `.azure/deployment-plan.md` | This plan | ✅ | |
| 155 | +| `infra/main.bicep` | Root Bicep template | ⏳ | |
| 156 | +| `infra/modules/vmss.bicep` | VMSS + autoscale config | ⏳ | |
| 157 | +| `infra/modules/network.bicep` | VNet, subnets, NSG, AppGW | ⏳ | |
| 158 | +| `infra/modules/sql.bicep` | Azure SQL Server + Database | ⏳ | |
| 159 | +| `infra/modules/monitoring.bicep` | Log Analytics + App Insights | ⏳ | |
| 160 | +| `infra/modules/keyvault.bicep` | Key Vault + secrets | ⏳ | |
| 161 | +| `infra/cloud-init.yaml` | VM bootstrap script (Node.js setup) | ⏳ | |
| 162 | +| `src/web/package.json` | Node.js dependencies | ⏳ | |
| 163 | +| `src/web/tsconfig.json` | TypeScript config | ⏳ | |
| 164 | +| `src/web/src/index.ts` | Express app entry point | ⏳ | |
| 165 | + |
| 166 | +--- |
| 167 | + |
| 168 | +## 9. Cost Estimate |
| 169 | + |
| 170 | +| Resource | Unit Cost | Monthly Estimate | |
| 171 | +|----------|-----------|-----------------| |
| 172 | +| VMSS (2–6× Standard_D4s_v5) | $0.192/hr per VM | $280–$840 | |
| 173 | +| Application Gateway v2 | ~$0.246/hr + data | ~$180 | |
| 174 | +| Azure SQL S2 (50 DTU) | ~$75/mo | ~$75 | |
| 175 | +| Log Analytics (5 GB/day) | ~$2.30/GB | ~$350 | |
| 176 | +| Key Vault | ~$0.03/10K ops | <$5 | |
| 177 | +| **Total estimate** | | **~$885–$1,450/mo** | |
| 178 | + |
| 179 | +> 💡 Consider 1-year reserved instances for VMSS to save ~35%. |
| 180 | +
|
| 181 | +--- |
| 182 | + |
| 183 | +## 10. Next Steps |
| 184 | + |
| 185 | +> Current: Awaiting user approval |
| 186 | +
|
| 187 | +1. User approves this plan |
| 188 | +2. Generate all infrastructure and application files |
| 189 | +3. Validate with azure-validate |
| 190 | +4. Deploy with azure-deploy |
0 commit comments