Skip to content

Add Web App support as 4th resource kind - #10

Merged
marcelloformica merged 1 commit into
mainfrom
webapp
Mar 26, 2026
Merged

marcelloformica merged 1 commit into
mainfrom
webapp

Conversation

@marcelloformica

Copy link
Copy Markdown
Contributor

Summary

Adds Azure Web App (microsoft.web/sites) as the 4th supported resource kind alongside VMs, SQL Databases, and Storage Accounts.

Changes

Web App availability model

  • MemoryWorkingSet metric (Average, bytes): >0 = available (1.0), =0 = stopped (suspect zero),
    ull = suspect null
  • No degraded state — binary up/down model
  • Function Apps excluded via kind contains 'functionapp' KQL filter

Activity Log lifecycle

  • stop/start/restart operations with configurable grace window
  • Paired stop→start spanning intervals — unlike VMs (where Resource Health reports 'Unavailable – Customer Initiated' for the entire deallocated period), stopped web apps show only 'Available' in Resource Health, so the full stopped window is inferred from Activity Log events

Universal improvements

  • Creation/deletion state machine for all resource kinds (not just WebApp) — handles before-first-write, between delete→recreate cycles, and after-final-delete non-existence intervals
  • MergeIntervals helper consolidates overlapping intervals

Bug fixes

  • PS timestamp precision: \ConvertFrom-Json\ converts ISO 8601 strings to DateTime objects; [string]\ loses sub-second precision. Fixed by checking \ -is [datetime]\ and constructing DateTimeOffset directly
  • C# locale formatting: SummaryWriter now uses \CultureInfo.InvariantCulture\ for decimal separators in summary output (was using system locale)

Cleanup

  • Fixed duplicate XML summary in ActivityLogService
  • Updated ResourceInventoryService doc to note Function App exclusion
  • README already synced with all webapp additions

Verification

Both PS and C# versions tested against 3 subscriptions (231 resources, 850 output lines) for February 2026 — 0 data differences after fixes.

- Web App (microsoft.web/sites) availability via MemoryWorkingSet metric
  (Average, bytes): >0 = available, 0 = stopped, null = suspect
- Function Apps excluded via 'kind contains functionapp' filter
- Activity Log lifecycle: stop/start/restart with grace window
- Paired stop->start spanning intervals (Resource Health does not track
  stopped web app state, unlike VM deallocation)
- Universal creation/deletion state machine for all resource kinds
- MergeIntervals helper for overlapping interval consolidation
- Fix PS timestamp precision: ConvertFrom-Json DateTime handling
  preserves sub-second accuracy via direct DateTimeOffset construction
- Fix C# locale formatting: SummaryWriter uses InvariantCulture for
  decimal separators in summary output
- Fix ActivityLogService duplicate summary comment
- Update ResourceInventoryService doc to note Function App exclusion
- Sync README with webapp additions
- Both PS and C# produce identical output (verified against 231 resources)
@marcelloformica
marcelloformica merged commit 5aa09bd into main Mar 26, 2026
1 check passed
@marcelloformica
marcelloformica deleted the webapp branch March 26, 2026 17:40
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