Skip to content

fix: orphaned resources query bugs + doc cleanup#31

Merged
msftnadavbh merged 1 commit intomainfrom
fix/orphaned-resources-cleanup
Mar 3, 2026
Merged

fix: orphaned resources query bugs + doc cleanup#31
msftnadavbh merged 1 commit intomainfrom
fix/orphaned-resources-cleanup

Conversation

@msftnadavbh
Copy link
Copy Markdown
Owner

Summary

Fixes two bugs in the orphaned resource detection queries introduced in PR #30and cleans up stale documentation left behind after the NIC/NSG removal.

Bug Fixes

1. SQL Elastic Pools query — missing filter (High severity)

The ORPHANED_SQL_ELASTIC_POOLS_QUERY had no where clause to filter for empty pools — it flagged every elastic pool in the tenant as orphaned, including pools actively hosting databases.

Fix: Added a leftanti join against microsoft.sql/servers/databases so only pools with zero databases are returned.

2. Private Endpoints query — false positives on manual-approval endpoints (Medium severity)

The query only checked privateLinkServiceConnections but Azure Private Endpoints also use manualPrivateLinkServiceConnections for manual approval workflows. Endpoints created with manual approval were incorrectly flagged as orphaned.

Fix: Now checks both privateLinkServiceConnections and manualPrivateLinkServiceConnections arrays, including their respective connection states.

Documentation Updates

Testing

All 188 tests pass (includes 31 orphaned resource tests + 27 new Databricks tests).

- Fix SQL Elastic Pools query: add leftanti join to filter for pools
  with no databases (previously flagged ALL pools as orphaned)
- Fix Private Endpoints query: check both privateLinkServiceConnections
  and manualPrivateLinkServiceConnections to avoid false positives on
  manual-approval endpoints
- Update USAGE_EXAMPLES.md: replace stale NIC/NSG references with the
  current 11 resource types
- Update CHANGELOG.md: add v3.4.0 entry for Databricks tools (PR #28)
  and orphaned resources expansion + fixes (PR #30)
- Align formatters.py section dividers for consistency
@msftnadavbh msftnadavbh merged commit 3a9c359 into main Mar 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant