docs: fix inaccurate Customize Azure resources page#946
Open
IEvangelist wants to merge 1 commit into
Open
Conversation
IEvangelist
force-pushed
the
dapine/fix-customize-azure-resources-246
branch
from
May 14, 2026 14:10
5aee9a1 to
7e21b4b
Compare
IEvangelist
marked this pull request as ready for review
May 31, 2026 04:38
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the “Customize Azure resources” documentation to correct several Aspire Azure API inaccuracies and improve guidance for custom Bicep workflows.
Changes:
- Corrects the custom Bicep template samples to use the public
AddBicepTemplateAPI and demonstrates consuming Bicep outputs viaGetOutput. - Replaces the fabricated private endpoint example with Aspire’s
AddPrivateEndpointbuilder pattern and clarifies how to inspect generated Bicep viaaspire publish/deploy. - Adds TypeScript twoslash allowlist entries for a known
withParameteroverload-emission issue in the generatedaspire.d.ts.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/frontend/src/content/docs/integrations/cloud/azure/customize-resources.mdx | Fixes incorrect APIs/examples and expands docs with output/parameter patterns and correct Bicep inspection steps. |
| src/frontend/tests/unit/twoslash-blocks-audit.ts | Adds allowlist entries for known twoslash type errors related to withParameter overload generation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
413
to
+417
| <Aside type="note"> | ||
| Adding strongly-typed Azure SDK constructs such as `PrivateEndpoint` is not | ||
| supported in the TypeScript AppHost. Use the C# AppHost when you need to inject | ||
| additional Azure resources into the generated infrastructure. | ||
| `AddPrivateEndpoint` and the supporting `Aspire.Hosting.Azure.Network` resource | ||
| builders are not currently available in the TypeScript AppHost. Use the C# | ||
| AppHost when you need to model private endpoints with Aspire's higher-level | ||
| APIs. |
Rebased onto main, which replaced the twoslash "known type-bugs" allowlist with a zero-diagnostics policy (#1085). Dropped the now-obsolete allowlist entries this PR had added to twoslash-blocks-audit.ts. The new TypeScript samples call `withParameter(..., { value })` with string and ParameterResource values, which the generated `aspire.d.ts` previously rejected (ts2769) because it only encoded the trailing `EndpointReference` overload. Broaden the `withParameter` value type to match the real polyglot `[AspireUnion]` surface (string | string[] | ParameterResource | IResourceWithConnectionString | BicepOutputReference | ReferenceExpression | EndpointReference), via a generate-twoslash-types.ts override plus the regenerated types, so the samples compile cleanly under the new policy. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: bb383d2d-2eb5-4012-9848-7587001c7090
IEvangelist
force-pushed
the
dapine/fix-customize-azure-resources-246
branch
from
July 21, 2026 17:19
7e21b4b to
d74aba8
Compare
Contributor
Frontend HTML artifact readyThe latest frontend build uploaded the This comment updates automatically when a new frontend build artifact is uploaded. |
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.
Fixes #246
Problem
The page at https://aspire.dev/integrations/cloud/azure/customize-resources/ contains three concrete API inaccuracies that mislead readers building custom Bicep workflows. Verified each claim against the microsoft/aspire
mainsource tree and against the live page on aspire.dev (see Evidence below).Changes
All edits are scoped to
src/frontend/src/content/docs/integrations/cloud/azure/customize-resources.mdxplus one allowlist entry pair insrc/frontend/tests/unit/twoslash-blocks-audit.ts(see Twoslash note below).AddBicepTemplateinstead ofAddAzureBicepResourcein the C# Use custom Bicep files sample.AddAzureBicepResourceis not a public API; the real APIs areAddBicepTemplate(name, bicepFile)andAddBicepTemplateString(name, bicepContent). The TypeScript sample was already using the correctaddBicepTemplatename..WithReference(storage)on the bicep resource with.WithEnvironment("STORAGE_CONNECTION_STRING", storage.GetOutput("connectionString")).AzureBicepResourcedoes not implementIResourceWithConnectionString, so the original snippet did not compile. ShowingGetOutputhere also addresses one of the reporter's wishlist items (consuming outputs from a custom Bicep template).aspire run) does not write Bicep into the project — local provisioning compiles each module into aDirectory.CreateTempSubdirectory("aspire")location (seeAzureProvisioningResource.csandAzureBicepResource.cs). Updated the steps to useaspire publish(oraspire deploy) and to look in theaspire-outputfolder (the publish/deploy default perPublishCommandStrings.resx— "Defaults to the AppHost directory's 'aspire-output' folder if not specified"). Added anotecallout calling out the difference and atipcallout pointing to the Azure Portal Export template trick.SubnetReferenceexample in Add Azure resources to the infrastructure with the idiomatic Aspire pattern usingAzurePrivateEndpointExtensions.AddPrivateEndpoint(fromAspire.Hosting.Azure.Network). Added a TypeScript note that the high-level builders are C#-only today, plus a fallback paragraph pointing readers atConfigureInfrastructure+Azure.Provisioningfor advanced needs not covered by Aspire-native builders.AddParameter(name, secret: true),WithParameter(name, parameterResource), andGetOutput(name). Added a bulleted list of the supportedWithParametervalue types (ParameterResource,BicepOutputReference,ReferenceExpression,IResourceWithConnectionString,EndpointReference) and aLearnMorelink to theplayground/bicepsample for end-to-end scenarios — closes the wishlist items in the issue.tipaboutAddBicepTemplateString/addBicepTemplateStringfor inline Bicep snippets.playground/bicepsample link.Evidence
Confirmed the issue still reproduces on the live aspire.dev page today via Playwright + DOM probe:
Quoted before/after for each section:
Use custom Bicep files (C#):
Add Azure resources to the infrastructure (C#):
Inspect generated Bicep:
How I verified
microsoft/aspire.dev:mainandmicrosoft/aspire:main, then rebaseddapine/fix-customize-azure-resources-246onto the new tip so the PR diff is exactly two files.microsoft/aspireand the matching polyglot TypeScript usage intests/PolyglotAppHosts/to confirm the real API surface (signatures and call patterns).pnpm --dir src/frontend test:unit:twoslash-blocks— PASS (the twoKNOWN_TYPE_BUGSentries cleanly cover the generator's collapsed-overload bug).pnpm --dir src/frontend test:unit:llms-txt— PASS.pnpm --dir src/frontend lint— PASS for the two changed files (pre-existing repo-wide warnings unrelated to this branch).Twoslash note
The two new TypeScript twoslash blocks call
withParameter(name, { value })with astringand aParameterResource. The polyglot testtests/PolyglotAppHosts/Aspire.Hosting.Azure/TypeScript/apphost.tsuses this exact pattern, so the runtime API supports it. However, the currentaspire.d.tsgenerator only emits the lastwithParameteroverload ({ value?: EndpointReference }), so twoslash reportsts(2769) — No overload matches this call.Added twoKNOWN_TYPE_BUGSentries with a clear label so the regression gate stays precise; the entries fall out automatically once the generator emits all overloads (separate, pre-existing concern inscripts/generate-twoslash-types.ts).Out of scope
withParameteris emitted toaspire.d.ts. Worth a follow-up issue againstscripts/generate-twoslash-types.ts, but outside the scope of this docs fix.existingBicep keyword (one of the reporter's wishlist items) — theLearnMorehere points readers at theplayground/bicepsample, and a full guide can land as a follow-up.