Idle Azure SQL Database
What does ZopNight detect here?
Idle detection for Azure SQL databases requires DTU utilization below 5% over 30 days plus a present SQLConnectionSuccessful series showing no connections. Serverless databases get auto-pause savings from the measured idle fraction; provisioned tiers get a one-tier DTU step-down priced from real rate deltas, abstaining when neither quantifies.
Signal and threshold
| Field | Value |
|---|---|
| Rule IDs | RC-203 |
| Category | idle |
| Severity | medium |
| Metric | none — pure configuration read |
| Source | idle_sql.go |
Where it applies
Low DTU plus no successful connections
- MetricsAware: DTUPercentage over 30 days (low-DTU gate) and SQLConnectionSuccessful (required; absent => abstain; >0 => in use, skip)
- ScheduleAware (SetScheduleData): measured idle fraction for the serverless auto-pause branch
- SKURatesAware (SetSKURates) + TargetSKUCandidates: source/target DTU-tier rates for the non-serverless step-down branch
The DTU floor and lookback window
azureDTUThreshold=5.0, azureDTULookbackDays=30Auto-pause or a one tier DTU step down
branched on compute tier; no flat fraction.
- Serverless-vCore → enable/shorten auto-pause. Auto-pause stops the compute charge only (storage keeps billing). Saving = cost × sd.IdlePercentage (real measured idle fraction from SetScheduleData); absent/zero idle data => abstain.
- Non-serverless (DTU model / provisioned vCore) → one-tier DTU step-down (rightsize). Pause is impossible; priced from the real source→target DTU-tier rate delta via DeriveCatalogDiffSavings(src, dst, cost, 0) (mirrors sibling RC-230, lever suggestSmallerSQLDTU). No smaller rung resolves, or either DTU-tier rate missing/inverted/out-of-band => saving 0 => abstain (no 30% estimate under the cost-driven idle category). Abstains on pricing absent (cost ≤ 0). EvalContextRule: a DB with a known active schedule is suppressed (intentionally parked off-hours, not abandoned).
Pausing, scaling down, or dropping the database
- Check Azure Monitor metrics for DTU/CPU usage
- Verify no applications are connecting
- Serverless: configure auto-pause delay (min 15 min); storage keeps billing while paused. Non-serverless: scale down one DTU tier.
- If not needed, delete the SQL database
DTU usage paired with a connection guard
DTUPercentage (DTU avg gate) + SQLConnectionSuccessful (required corroborating activity guard), both over azureDTULookbackDays (30d)