feat(health): scope storage check to script host - #11927
Open
Jacob Viau (jviau) wants to merge 4 commits into
Open
Jacob Viau (jviau) wants to merge 4 commits into
Jacob Viau (jviau) wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts how the WebJobsStorageHealthCheck is registered and scoped so that it only runs when AzureWebJobsStorage is actually configured, avoiding false “unhealthy” results for apps (e.g., Service Bus–only) that don’t require Storage. It also moves the storage health check into the ScriptHost/JobHost DI scope so it participates correctly in ScriptHost lifetime and disposal.
Changes:
- Introduces
IConfiguration.IsPlaceholderModeEnabled()and uses it to gate registration in placeholder mode. - Adds
AddJobHostScopedHealthChecks(IConfiguration)to conditionally registerWebJobsStorageHealthCheckonly when storage configuration is present (scalar or hierarchical). - Updates
WebJobsStorageHealthCheckto remove WebHost-only dependencies and support bothIDisposableandIAsyncDisposable, with corresponding test updates.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/WebJobs.Script.Tests/Extensions/ConfigurationExtensionsTests.cs | Adds unit tests for the new IConfiguration.IsPlaceholderModeEnabled() helper. |
| test/WebJobs.Script.Tests/Diagnostics/HealthChecks/WebJobsStorageHealthCheckTests.cs | Updates storage health check tests to match the simplified constructor and removed WebHost-only behaviors. |
| test/WebJobs.Script.Tests/Diagnostics/HealthChecks/HealthCheckExtensionsTests.cs | Adds coverage for conditional JobHost-scoped storage health check registration and sync disposal behavior. |
| src/WebJobs.Script/ScriptHostBuilderExtensions.cs | Registers JobHost-scoped health checks during ScriptHost service configuration. |
| src/WebJobs.Script/Environment/ConfigurationExtensions.cs | Adds IConfiguration placeholder-mode detection used for registration gating. |
| src/WebJobs.Script/Diagnostics/HealthChecks/WebJobsStorageHealthCheck.cs | Removes placeholder/ScriptHostManager dependencies and adds sync + async disposal support. |
| src/WebJobs.Script/Diagnostics/HealthChecks/HealthCheckExtensions.cs | Moves storage check registration behind new JobHost-scoped conditional registration API. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Jacob Viau (jviau)
force-pushed
the
u/jviau/move-storage-health-check
branch
from
August 20, 2026 16:47
425cfa1 to
7d87f54
Compare
Register the WebJobs storage health check only for active, non-placeholder script hosts with configured storage.
Resolve the final ScriptHost configuration through health check options and register the storage check only when storage is configured. Skip JobHost health-check services entirely for placeholder hosts and cover both paths end to end.
Jacob Viau (jviau)
force-pushed
the
u/jviau/move-storage-health-check
branch
from
August 27, 2026 16:43
a2538bb to
7f78cf0
Compare
Brett Samblanet (brettsam)
requested changes
Aug 27, 2026
Use the per-host standby configuration snapshot when registering health checks and prevent WebHost publishers from flowing into the JobHost child container.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue describing the changes in this PR
resolves #11636
Pull request checklist
IMPORTANT: Currently, changes must be backported to the
in-procbranch to be included in Core Tools and non-Flex deployments.in-procbranch is not requiredrelease_notes.mdAdditional information
Moves
WebJobsStorageHealthCheckinto the ScriptHost service scope. Placeholder hosts skip JobHost health-check registration entirely. For active hosts, storage registration is deferred throughHealthCheckServiceOptionsso it evaluates the final DI-providedIConfigurationand registers only whenAzureWebJobsStoragehas a non-empty scalar or hierarchical configuration value.The health check no longer depends on WebHost-only state, supports both synchronous and asynchronous disposal to match ScriptHost lifetime management, and has end-to-end coverage for configured storage and placeholder hosts.