Skip to content

Document the Microsoft Entra ID integration for Aspire 17.0 - #2086

Open
Eric Erhardt (eerhardt) wants to merge 2 commits into
release/17.0from
eerhardt-entra-id-docs
Open

Eric Erhardt (eerhardt) wants to merge 2 commits into
release/17.0from
eerhardt-entra-id-docs

Conversation

@eerhardt

Copy link
Copy Markdown
Member

Summary

Documents the Microsoft Entra ID hosting integration (epic microsoft/aspire#21060) as one consolidated set of pages under integrations/security/microsoft-entra-id/. It replaces ten independent bot-written draft PRs that overlapped, edited the same files, and in places contradicted the shipped API. Every claim was checked against microsoft/aspire (README, code, [AspireExport] attributes, polyglot fixtures, tests, and the end-to-end deployment tests).

New pages:

Page Covers
Overview (index) Preview posture, prerequisites, package install, run vs publish, settings workloads receive, connection names
Secure a web app and API Web-to-API walkthrough, local vs Azure deployment
Redirect URIs and sign-in Endpoint-derived, host-parameter, and literal URIs, browser origins, ID-token issuance, audiences, sovereign clouds
Client credentials Secret, local developer certificate, managed identity federation, Key Vault certificate (+ automatic cert-read RBAC), store, file, x5c
Expose and call APIs Scopes, application ID URI, API permissions, DownstreamApis, consent, pre-authorization, Graph and custom APIs
Application roles WithAppRole, retirement rules, PublishWithAppRoleAssignment for managed identities
Existing registrations AddExistingEntraApplication vs AsExistingApplication, supported vs rejected settings
Customize infrastructure ConfigureInfrastructure, tags, serviceManagementReference, experimental Aspire.Hosting.Azure.Provisioning.EntraId (ASPIREAZUREPROVISIONING001)
Lifecycle and permissions Permissions matrix, create/redeploy/cleanup, tenant suffix, owners, retained grants, limitations, transient Graph failures, troubleshooting

Other changes: sidebar group under Security & identity, a Microsoft Entra ID row in the Azure provisioning package table, and cross-links from the local provisioning, user-assigned identity, and Key Vault pages.

Superseded drafts (closed after this PR opens): #1928, #1934, #1944, #1964, #1973, #1991, #2027, #2028, #2031, #2043.

Consolidation notes and assumptions

  • Defects in the drafts that were not carried over: apphost.ts titles, the wrong syncKey, C# before TypeScript, a nonexistent prerelease prop on InstallPackage, an unverified shortName, aligned fluent indentation, the stale "add URL callbacks before WithRedirectUris" note (resolution now waits for all URL customizations), and a claim that local-provisioning.mdx documents "Missing subscription configuration".
  • The 17.0 what's-new page is intentionally not edited ([docs] Note Entra ID application missing-subscription state fix in Aspire 17.0 #1928 only touched that page), per the task instructions.
  • TypeScript samples are not twoslash-annotated because the bundled twoslash data predates the Entra package. The method names and option shapes were verified against apphost.mts and the [AspireExport] attributes. C#-only APIs (WithCredential, EntraIdApi, EntraIdApiPermission, EntraIdAppRole) show C# only or use the TypeScript DTO equivalents.
  • Nested sidebar items carry no per-item locale translations, matching every other nested integration group in integrations.topics.ts.
  • integration-docs.json mappings were intentionally not added. reconcileIntegrationDocs prunes official-package entries missing from aspire-integrations.json, so pnpm test:unit:structured-data fails until the packages appear on NuGet. They can be added by the integrations updater afterwards.
  • No <ApiReference> components are used because no generated API data exists for these packages yet.

Open questions and unverifiable claims

  • Epic items still open and not reflected as final: API review (#21075), security review (#21080), release docs/samples (#21079), platform and failure-path dispositions (#21078).
  • "Azure CLI with Bicep 0.36.1 or later" comes only from the integration README and playground README.
  • The AzureAd Microsoft.Identity.Web snippets were checked against Microsoft.Identity.Web source (AddMicrosoftIdentityMessageHandler(IConfiguration, string), EnableTokenAcquisitionToCallDownstreamApi, AddMicrosoftIdentityWebApi) but not executed end to end.
  • The app-role sample's use of WithAllowWebApiToBeAuthorizedByACL follows the shipped end-to-end deployment test. The exact Microsoft.Identity.Web rejection behavior for tokens without roles is from that test and the option's XML doc.
  • Transient Graph failures after registration creation are documented as a known limitation with "deploy again" guidance, per #21372. No automatic retry exists in 17.0.

Third-party links and affiliations

None. All added links point to Microsoft-owned sites (learn.microsoft.com, entra.microsoft.com, aka.ms, devblogs.microsoft.com, nuget.org package pages) and the existing aspire.dev docs.

Validation

Run from src/frontend; pnpm build was not run, per repository policy:

  • pnpm install --frozen-lockfile: passed
  • pnpm test:unit:structured-data: passed (5 files, 99 tests)
  • pnpm exec vitest run --config vitest.config.ts: passed (97 files, 1398 passed, 1 skipped), including seo-lengths, typescript-first-apphost-tabs, and twoslash-blocks
  • pnpm exec eslint config/sidebar/integrations.topics.ts --max-warnings 0: passed
  • pnpm exec prettier --write config/sidebar/integrations.topics.ts: applied
  • A script that resolves every internal link and anchor in the new and edited pages: all OK
  • Style sweep for em dashes, bold lead-in bullets, Overview headings, non-TypeScript-first tabs, bad syncKey/titles, and missing trailing slashes: clean
  • Three independent read-only fact-check passes against the microsoft/aspire sources; all reported discrepancies were fixed before this commit
  • Regenerated .starlight-icons/* and twoslash/aspire.d.ts were restored and are not in the commit

Add a multi-page Microsoft Entra ID integration section under
integrations/security/microsoft-entra-id covering the hosting package,
redirect URIs and sign-in, client credentials, exposing and calling APIs,
application roles, existing registrations, infrastructure customization,
lifecycle and permissions, and a web-to-API walkthrough.

Consolidates and supersedes the independent draft PRs #1928, #1934, #1944,
#1964, #1973, #1991, #2027, #2028, #2031, and #2043. Every claim was
verified against microsoft/aspire. Also adds the sidebar group, an Entra row
in the Azure provisioning package table, and cross-links from related Azure
pages.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

@aspire-repo-bot aspire-repo-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated wording suggestions from the forbidden-words check. Apply the suggestions to resolve them.

- [Azure user-assigned managed identities](/integrations/cloud/azure/user-assigned-identity/)
- [Microsoft Entra ID documentation](https://learn.microsoft.com/entra/identity-platform/)
- [Bicep templates for Microsoft Graph](https://learn.microsoft.com/graph/templates/bicep/overview-bicep-templates-for-graph)
- [Securing .NET Aspire apps with Microsoft Entra ID](https://devblogs.microsoft.com/aspire/securing-dotnet-aspire-apps-with-microsoft-entra-id/)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use "Aspire" instead of ".NET Aspire".

Suggested change
- [Securing .NET Aspire apps with Microsoft Entra ID](https://devblogs.microsoft.com/aspire/securing-dotnet-aspire-apps-with-microsoft-entra-id/)
- [Securing Aspire apps with Microsoft Entra ID](https://devblogs.microsoft.com/aspire/securing-dotnet-aspire-apps-with-microsoft-entra-id/)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved documentation errors can break authentication and consent flows, block frontend startup, prevent preview-package restoration, and mislead readers about certificate rollover requirements.

5 open issues
What changed in this PR

Adds a consolidated Microsoft Entra ID integration guide for Aspire 17.0, replacing overlapping draft documentation and connecting it to existing Azure guidance.

Changes:

  • Adds nine pages covering registration setup, authentication, credentials, API permissions, roles, and lifecycle management.
  • Provides TypeScript and C# AppHost examples with preview limitations and deployment requirements.
  • Adds sidebar navigation, a provisioning-package entry, and related Azure cross-links.
File Description
src/​frontend/​src/​content/​docs/​integrations/​security/​microsoft-entra-id/​secure-web-and-api.mdx Adds a local-to-Azure authentication walkthrough.
src/​frontend/​src/​content/​docs/​integrations/​security/​microsoft-entra-id/​redirect-uris-and-sign-in.mdx Covers callbacks, audiences, and sovereign clouds.
src/​frontend/​src/​content/​docs/​integrations/​security/​microsoft-entra-id/​lifecycle-and-permissions.mdx Explains permissions, cleanup, and troubleshooting.
src/​frontend/​src/​content/​docs/​integrations/​security/​microsoft-entra-id/​index.mdx Introduces installation, configuration, and preview status.
src/​frontend/​src/​content/​docs/​integrations/​security/​microsoft-entra-id/​expose-and-call-apis.mdx Documents scopes, consent, and downstream API calls.
src/​frontend/​src/​content/​docs/​integrations/​security/​microsoft-entra-id/​existing-registrations.mdx Explains references to externally managed registrations.
src/​frontend/​src/​content/​docs/​integrations/​security/​microsoft-entra-id/​customize-infrastructure.mdx Demonstrates Microsoft Graph infrastructure customization.
src/​frontend/​src/​content/​docs/​integrations/​security/​microsoft-entra-id/​client-credentials.mdx Covers secrets, certificates, and identity federation.
src/​frontend/​src/​content/​docs/​integrations/​security/​microsoft-entra-id/​app-roles.mdx Documents role declarations and managed identity assignments.
src/​frontend/​src/​content/​docs/​integrations/​cloud/​azure/​user-assigned-identity.mdx Links to Entra application-role assignments.
src/​frontend/​src/​content/​docs/​integrations/​cloud/​azure/​local-provisioning.mdx Links to the Entra integration overview.
src/​frontend/​src/​content/​docs/​integrations/​cloud/​azure/​customize-resources.mdx Adds the Entra provisioning package and guidance.
src/​frontend/​src/​content/​docs/​integrations/​cloud/​azure/​azure-key-vault/​azure-key-vault-host.mdx Links to certificate credentials and automatic access grants.
src/​frontend/​config/​sidebar/​integrations.topics.ts Adds the Microsoft Entra ID navigation group.

Review effort: Balanced

})
.publishWithAppRoleAssignment(worker, ["Orders.Read"]);

const api = await builder.addContainer("api", "my-api-image");

## Send the certificate chain

`WithSendX5C` sends the `x5c` claim, which carries the public certificate, with token requests. This enables certificate rollover without redeploying the app. It applies only to certificate-based credentials and increases the size of each token request, so it's opt-in.

Add the [📦 Aspire.Hosting.Azure.EntraId](https://www.nuget.org/packages/Aspire.Hosting.Azure.EntraId) package to your AppHost:

<InstallPackage packageName="Aspire.Hosting.Azure.EntraId" />

app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
```csharp title="Web/Program.cs"
builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApp(builder.Configuration)
.EnableTokenAcquisitionToCallDownstreamApi()
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Frontend HTML artifact ready

The latest frontend build uploaded the frontend-dist artifact for PR #2086. Use the VS Code button below to open this PR with GitHub Artifacts Explorer and browse the built HTML locally.

VS Code: Open PR #2086 artifacts

This comment updates automatically when a new frontend build artifact is uploaded.

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.

2 participants