[POC — DO NOT MERGE] Managed Hosting SDK + sample extension (BlobPocExtension)#376
Draft
gary-x-li wants to merge 6 commits into
Draft
[POC — DO NOT MERGE] Managed Hosting SDK + sample extension (BlobPocExtension)#376gary-x-li wants to merge 6 commits into
gary-x-li wants to merge 6 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #376 +/- ##
=======================================
Coverage 52.18% 52.18%
=======================================
Files 108 108
Lines 2106 2106
Branches 235 235
=======================================
Hits 1099 1099
Misses 954 954
Partials 53 53 🚀 New features to boost your workflow:
|
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.
Summary
This is a proof-of-concept, draft PR opened for discussion only — it is not intended to be merged. Nothing here is finalized; APIs, names, structure, and conventions are all up for debate. The goal is to make two things tangible:
Azure.Deployments.Extensibility.Hosting.Managed— that wraps the existingAspNetCoreSDK with the platform-contract defaults a managed/platform-hosted extension needs (port binding, health endpoint, local-dev relaxations), so an extension author writes minimal boilerplate.BlobPocExtension— built on that facade, exercising real Azure Storage data-plane I/O to show the end-to-end authoring experience (typed handlers, cross-cutting behaviors, health checks, DI, error mapping).What's in here
New SDK:
Azure.Deployments.Extensibility.Hosting.ManagedBicepExtension— a thin facade overExtensionApplicationexposingCreateBuilder,ConfigureServices,AddExtensionVersion,AddHealthCheck<T>,ConfigureApiExplorerExamples, andRun. Applies managed-hosting defaults: binds Kestrel toEXTENSION_PORT(default 8080), always mapsGET /health, etc.DevelopmentHeaderBackfillStartupFilter— local-dev convenience that backfills platform-injected headers so the extension can be driven directly (Scalar UI /.http/ curl) without the platform in front of it.Sample: BlobPocExtension
Containerresource type (Blob deferred), exact version1.0.0, storage account assumed to pre-exist (control-plane out of scope).MagicEightBallExtensionpattern) registered in the pipeline so handlers stay pure I/O:AccountNameValidationBehavior— validatesaccountName(also an SSRF guard,^[a-z0-9]{3,24}$)ApiVersionValidationBehavior— rejects unsupportedapiVersionStorageExceptionHandlingBehavior— mapsRequestFailedException→ structuredErrorResponse(now surfacing storage error code + request id)DefaultAzureCredentialonly —az loginlocally, managed identity in cloud. No secrets/connection strings/Azurite.local-testing/— a self-contained guide and tooling: README.md,requests.http,storage-account.bicep(account + Storage Blob Data Contributor role),acr.bicep(registry with anonymous pull disabled), and instructions to publish a self-containedlinux-x64single-file binary and push it as an OCI artifact via ORAS.How to try it
See README.md: deploy
storage-account.bicep,dotnet run, then drive the endpoints fromrequests.http(or the Scalar UI at/scalar/v2). The publishing section covers the self-contained binary + ORAS/ACR flow.