Skip to content

Export Entra ID hosting integration to polyglot AppHosts - #21361

Merged
Eric Erhardt (eerhardt) merged 10 commits into
mainfrom
eerhardt-entra-polyglot-exports
Oct 28, 2026
Merged

Eric Erhardt (eerhardt) merged 10 commits into
mainfrom
eerhardt-entra-polyglot-exports

Conversation

@eerhardt

@eerhardt Eric Erhardt (eerhardt) commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Description

Enables polyglot AppHosts to use the Entra ID hosting integration, including new registrations, configuration-only references to existing registrations, consumer settings, all built-in credential kinds, owners, deferred redirect URIs, application roles, API scopes and permissions, admin consent, and managed-identity federation.

Fixes #21076

Supersedes #21292, whose coverage is included here: Rust fixture plus Rust runner compilation, CI routing for every fixture language, and generic withReference dispatch coverage.

Existing C# signatures and behavior are preserved, as is the package's preview versioning. Overloaded C# APIs remain available; internal ATS adapters expose one typed capability per concept. Entra references use the existing generic withReference dispatcher rather than introducing a competing export.

  • Tenant and client IDs independently accept literals or parameter resources.
  • Top-level addExistingEntraApplication does not enable Azure provisioning or query Graph. Fluent asExistingApplication retains previously enabled Azure setup.
  • Endpoint redirects remain deferred through run and publish, and secret/password parameters retain secret tracking.
  • Exports withAppRole(value, displayName, description, { allowedMemberTypes, id, isEnabled }) over the new EntraIdAppRole API; the generated Bicep matches the C# call.
  • Exports withApplicationIdUri, withScope, getScopeUri, withPreAuthorizedApplication, withApiPermissions and withAdminConsent for registrations in the AppHost, plus withExternalApiPermissions/withExternalApiAdminConsent for Microsoft Graph and other APIs (well-known API enum or custom API DTO). withEntraIdReference is the only way to set the DownstreamApis prefix, since the generic withReference dispatcher has no slot for it.
  • Adds behavior and generated TypeScript contract coverage, adds dedicated Go, Java, Python, Rust and TypeScript tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId fixtures that exercise every export, updates test routing, and documents TypeScript usage.

Examples

Existing C# AppHosts continue to work unchanged:

var tenantId = builder.AddParameter("entra-tenant");
var clientId = builder.AddParameter("entra-client");
var secret = builder.AddParameter("entra-secret", secret: true);
var entra = builder.AddExistingEntraApplication("entra", tenantId, clientId)
    .WithClientSecret(secret);
builder.AddContainer("worker", "my-worker-image")
    .WithReference(entra, connectionName: "AUTH");

Generated TypeScript supports mixed ID inputs and typed credential arguments:

const tenantId = await builder.addParameter("entra-tenant");
const secret = await builder.addParameter("entra-secret", { secret: true });
const entra = await builder.addExistingEntraApplication(
    "entra", tenantId, "00001111-aaaa-2222-bbbb-3333cccc4444")
    .withClientSecret(secret);
await builder.addExecutable("worker", "node", ".", ["worker.mjs"])
    .withReference(entra, { connectionName: "AUTH" });

New registrations support deferred endpoint redirects and publish-time federation:

const entra = await builder.addEntraIdApplication("entra");
const web = await builder.addContainer("web", "my-web-image")
    .withHttpEndpoint({ targetPort: 8080 })
    .withReference(entra);
await entra.withRedirectUris(await web.getEndpoint("http"), {
    callbackPaths: ["/signin-oidc"],
});
await entra.publishWithFederatedManagedIdentityCredential({ identity: web });

Security considerations

This exposes existing identity and credential configuration through ATS; it does not install or configure workload authentication libraries, add scopes/consent, or change authorization behavior. Client secrets and certificate passwords require secret parameters. Existing registrations are never modified. Creating registrations and federation trust still requires the existing Azure/Graph permissions; owners can manage registrations. Certificate and assertion paths identify files on the consumer, not files read by the AppHost.

Validation

The following commands were run on Windows:

Command Result
dotnet test --project tests\Aspire.Hosting.Azure.EntraId.Tests\Aspire.Hosting.Azure.EntraId.Tests.csproj --no-launch-profile -- --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true' Passed, 452 tests
dotnet test --project tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests.csproj --no-launch-profile -- --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true' Passed, 153 tests
dotnet test --project tests\Infrastructure.Tests\Infrastructure.Tests.csproj --no-launch-profile -- --filter-namespace 'Infrastructure.Tests.TestTriggerMap' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true' 314 passed, 22 failed: Windows bash-path failures in PrComparisonBaseTests and access-denied cleanup of temporary Git objects in SelectTestsCliTests
dotnet test --project tests\Infrastructure.Tests\Infrastructure.Tests.csproj --no-launch-profile -- --filter-namespace 'Infrastructure.Tests.TestTriggerMap' --filter-not-class '*.PrComparisonBaseTests' --filter-not-class '*.SelectTestsCliTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true' Passed, 255 map, acceptance, and graph tests
dotnet run --project tools\SelectTests -- --changed-files artifacts\entra-polyglot\changed-files.txt --explain All changed files attributed; selected Entra, Azure, TypeScript codegen, and infrastructure tests plus polyglot/API compatibility jobs
dotnet build src\Aspire.Cli\Aspire.Cli.csproj --nologo -v:q /p:SkipNativeBuild=true Passed
Set-Location into a copy of each tests\PolyglotAppHosts\Aspire.Hosting.Azure.EntraId fixture (local project mapping), then aspire restore and npm run build / go build ./... / pyright / javac --enable-preview --source 25 / cargo check All five passed, mirroring the CI polyglot validation scripts
git diff --check Passed

Manual verification used the locally built CLI (dotnet .\artifacts\bin\Aspire.Cli\Debug\net11.0\aspire.dll) and a temporary generated TypeScript AppHost:

dotnet .\artifacts\bin\Aspire.Cli\Debug\net11.0\aspire.dll restore --apphost artifacts\entra-polyglot\apphost.mts --non-interactive
dotnet .\artifacts\bin\Aspire.Cli\Debug\net11.0\aspire.dll start --non-interactive --isolated --apphost artifacts\entra-polyglot\apphost.mts --format Json
dotnet .\artifacts\bin\Aspire.Cli\Debug\net11.0\aspire.dll describe --apphost artifacts\entra-polyglot\apphost.mts --format Json
dotnet .\artifacts\bin\Aspire.Cli\Debug\net11.0\aspire.dll logs consumer --apphost artifacts\entra-polyglot\apphost.mts --non-interactive
dotnet .\artifacts\bin\Aspire.Cli\Debug\net11.0\aspire.dll stop --apphost artifacts\entra-polyglot\apphost.mts --non-interactive
dotnet .\artifacts\bin\Aspire.Cli\Debug\net11.0\aspire.dll publish --apphost artifacts\entra-polyglot\apphost.mts --output-path artifacts\entra-polyglot\publish-existing --non-interactive --include-exception-details
dotnet .\artifacts\bin\Aspire.Cli\Debug\net11.0\aspire.dll deploy --apphost artifacts\entra-polyglot\apphost.mts --output-path artifacts\entra-polyglot\deploy-existing --non-interactive --include-exception-details
$env:ENTRA_SCENARIO='create'
dotnet .\artifacts\bin\Aspire.Cli\Debug\net11.0\aspire.dll publish --apphost artifacts\entra-polyglot\apphost.mts --output-path artifacts\entra-polyglot\publish-created --non-interactive --include-exception-details

All commands succeeded. Existing registrations reported healthy, and a Node consumer exited successfully after asserting its injected configuration, including secret and certificate password values. Configuration-only publish/deploy completed without Azure provisioning steps. New-registration publish generated Graph application/service-principal Bicep, owners, managed-identity federation, and environment-derived redirect URLs; the templates were inspected. The validation AppHost was stopped.

After rebasing onto main (including #21357), generated TypeScript AppHosts calling withAppRole and the scope/permission/consent exports published successfully; the Bicep contained the expected appRoles, identifier URIs, scopes and pre-authorized clients, and the consumer received the expected DownstreamApis configuration. No live Azure/Graph mutation was performed. Existing NU1903 advisories for System.Security.Cryptography.Xml were not changed.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21361

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21361"

@aspire-repo-bot
aspire-repo-bot Bot requested a balanced review from Copilot October 27, 2026 23:43
@github-actions github-actions Bot added the area-integrations Issues pertaining to Aspire Integrations packages label Oct 27, 2026
@github-actions

This comment has been minimized.

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.

🟢 Approval recommended

No active review issues remain for the Entra ID polyglot integration changes.

No open issues 🎉

What changed in this PR

Addresses #21076 by exposing the Entra ID hosting integration to polyglot AppHosts while preserving existing C# APIs and preview versioning.

Changes:

  • Adds typed exports for registrations, credentials, owners, deferred redirects, and managed-identity federation through the existing generic withReference dispatcher.
  • Adds behavior tests, TypeScript declaration snapshots, and Azure polyglot fixture coverage, with updated test routing.
  • Documents TypeScript usage and the distinction between configuration-only references and registrations that retain Azure provisioning setup.
File Description
tests/​PolyglotAppHosts/​Aspire.Hosting.Azure/​TypeScript/​aspire.config.json Adds the Entra integration to the fixture.
tests/​PolyglotAppHosts/​Aspire.Hosting.Azure/​TypeScript/​apphost.mts Exercises Entra exports in TypeScript.
tests/​Aspire.Hosting.CodeGeneration.TypeScript.Tests/​Snapshots/​EntraIdCodeGenerationTests.Exports_GenerateTypedDeclarationsAndDocumentation.verified.ts Records generated TypeScript contracts.
tests/​Aspire.Hosting.CodeGeneration.TypeScript.Tests/​EntraIdCodeGenerationTests.cs Checks exported declarations and documentation metadata.
tests/​Aspire.Hosting.CodeGeneration.TypeScript.Tests/​Aspire.Hosting.CodeGeneration.TypeScript.Tests.csproj References Entra for code-generation tests.
tests/​Aspire.Hosting.Azure.EntraId.Tests/​Snapshots/​EntraIdPolyglotTests.Redirects_KeepEndpointValuesDeferred_operation=Run.verified.bicep Captures deferred run-mode redirects.
tests/​Aspire.Hosting.Azure.EntraId.Tests/​Snapshots/​EntraIdPolyglotTests.Redirects_KeepEndpointValuesDeferred_operation=Publish.verified.bicep Captures deferred publish-mode redirects.
tests/​Aspire.Hosting.Azure.EntraId.Tests/​Snapshots/​EntraIdPolyglotTests.OwnersAndRedirects_PreserveDeferredValuesAndOrder.verified.bicep Captures owner and redirect composition.
tests/​Aspire.Hosting.Azure.EntraId.Tests/​Snapshots/​EntraIdPolyglotTests.Credentials_EmitTypedSettingsAndPreserveSecretReferences_operation=Run.verified.txt Captures resolved runtime credential settings.
tests/​Aspire.Hosting.Azure.EntraId.Tests/​Snapshots/​EntraIdPolyglotTests.Credentials_EmitTypedSettingsAndPreserveSecretReferences_operation=Publish.verified.txt Captures published settings with deferred secrets.
tests/​Aspire.Hosting.Azure.EntraId.Tests/​EntraIdProvisioningTests.cs Extends configuration-only deployment coverage to exports.
tests/​Aspire.Hosting.Azure.EntraId.Tests/​EntraIdPolyglotTests.cs Tests adapters, validation, references, and deferred values.
tests/​Aspire.Hosting.Azure.EntraId.Tests/​Aspire.Hosting.Azure.EntraId.Tests.csproj Adds capability-scanning test support.
src/​Aspire.Hosting.Azure.EntraId/​README.md Documents TypeScript examples and configuration semantics.
src/​Aspire.Hosting.Azure.EntraId/​EntraIdResourceExtensions.Polyglot.cs Adds typed, language-neutral export adapters.
src/​Aspire.Hosting.Azure.EntraId/​EntraIdResourceExtensions.cs Marks exports and preserves C# overloads.
src/​Aspire.Hosting.Azure.EntraId/​EntraIdApplicationResource.cs Integrates Entra with generic reference dispatch.
src/​Aspire.Hosting.Azure.EntraId/​Aspire.Hosting.Azure.EntraId.csproj Enables integration analyzers and removes the polyglot opt-out.
eng/​github-ci/​test-trigger-map.yml Routes Entra changes to polyglot validation.

Review effort: Balanced

@github-actions

This comment has been minimized.

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.

🟢 Approval recommended

No active review issues are identified for the Entra ID polyglot integration.

No open issues 🎉

Review effort: Balanced

Preserve C# APIs while adding typed ATS adapters, generic reference dispatch, credential and deferred value coverage, and TypeScript fixture validation.

Co-authored-by: Copilot App <[email protected]>
Add a withAppRole adapter over the new EntraIdAppRole API, with coverage, fixture usage, and README guidance.

Co-authored-by: Copilot App <[email protected]>
Add adapters for application ID URIs, scopes, scope URIs, first-party API permissions and consent, plus a reference export that sets the DownstreamApis prefix.

Co-authored-by: Copilot App <[email protected]>
@eerhardt
Eric Erhardt (eerhardt) force-pushed the eerhardt-entra-polyglot-exports branch from 0392698 to 6071440 Compare October 28, 2026 19:38
@github-actions

This comment has been minimized.

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

The generated SDK marks runtime-required Entra ID properties as optional, allowing type-valid objects to fail at runtime, and omits important consent-removal warnings.

2 open issues

Review effort: Balanced

Add Go, Java, Python, and TypeScript PolyglotAppHosts fixtures for the Entra integration, remove the TypeScript-only coverage in the shared Azure fixture and the generated-code snapshot test, and drop the redundant analyzer property.

Co-authored-by: Copilot App <[email protected]>
@github-actions

This comment has been minimized.

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

Undefined numeric enum values are silently treated as application permissions, allowing invalid input to generate app-only role assignments instead of being rejected.

3 open issues
1 file not reviewed
  • tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/TypeScript/package-lock.json: Generated file

Review effort: Balanced

…overage

Port the remaining coverage from the competing Entra polyglot PR: a Rust fixture compiled by the Rust validation runner, selector routing tests for every fixture language, generic withReference dispatch coverage for .NET and non-.NET consumers, and a README overview of polyglot AppHost support.

Co-authored-by: Copilot App <[email protected]>
@github-actions

This comment has been minimized.

The generic fixture-consumer routing test already covers every PolyglotAppHosts fixture.

Co-authored-by: Copilot App <[email protected]>
@github-actions

This comment has been minimized.

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

The generated SDK documentation incorrectly excludes existing registrations and should describe their configuration-only behavior while limiting provisioning claims to registrations created by Aspire.

4 open issues
1 file not reviewed
  • tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/TypeScript/package-lock.json: Generated file

Review effort: Balanced

Drop the partial class and place each internal export adapter, and the DTO types, in EntraIdResourceExtensions.cs beside the API it adapts.

Co-authored-by: Copilot App <[email protected]>
@github-actions

This comment has been minimized.

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

Catch-all permission handling accepts undefined numeric types as application permissions, allowing malformed input to silently request app-only access instead of failing validation.

1 open issue
4 resolved since last review
1 file not reviewed
  • tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/TypeScript/package-lock.json: Generated file

Review effort: Balanced

Reject undefined permission types instead of treating them as application permissions, mark required DTO properties, and document configuration-only existing registrations and non-additive consent in the exported API docs.

Co-authored-by: Copilot App <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

3 / 100 PR test projects · 2 PR jobs, from 31 changed files.

Selected PR test projects (3 / 100)

Aspire.Hosting.Azure.EntraId.Tests, Aspire.Hosting.Azure.Tests, Infrastructure.Tests

Selected PR jobs (2)

polyglot, typescript-api-compat


How these were chosen — grouped by what changed

🔧 src/Aspire.Hosting.Azure.EntraId/Aspire.Hosting.Azure.EntraId.csproj (changed source)
→ 2 directly: Aspire.Hosting.Azure.EntraId.Tests, Aspire.Hosting.Azure.Tests

🔧 src/Aspire.Hosting.Azure.EntraId/EntraIdApplicationResource.cs (changed source)
→ 2 directly: Aspire.Hosting.Azure.EntraId.Tests, Aspire.Hosting.Azure.Tests

🔧 src/Aspire.Hosting.Azure.EntraId/EntraIdResourceExtensions.cs (changed source)
→ 2 directly: Aspire.Hosting.Azure.EntraId.Tests, Aspire.Hosting.Azure.Tests

📄 .github/workflows/polyglot-validation/test-rust.sh (changed)
→ 1 directly: Infrastructure.Tests

📄 eng/github-ci/test-trigger-map.yml (changed)
→ 1 directly: Infrastructure.Tests

🧪 tests/Aspire.Hosting.Azure.EntraId.Tests/Aspire.Hosting.Azure.EntraId.Tests.csproj (changed test)
→ 1 directly: Aspire.Hosting.Azure.EntraId.Tests

🧪 tests/Aspire.Hosting.Azure.EntraId.Tests/EntraIdPolyglotTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Azure.EntraId.Tests

🧪 tests/Aspire.Hosting.Azure.EntraId.Tests/EntraIdProvisioningTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Azure.EntraId.Tests

🧪 tests/Aspire.Hosting.Azure.EntraId.Tests/Snapshots/EntraIdPolyglotTests.Credentials_EmitTypedSettingsAndPreserveSecretReferences_operation=Publish.verified.txt (changed test)
→ 1 directly: Aspire.Hosting.Azure.EntraId.Tests

🧪 tests/Aspire.Hosting.Azure.EntraId.Tests/Snapshots/EntraIdPolyglotTests.Credentials_EmitTypedSettingsAndPreserveSecretReferences_operation=Run.verified.txt (changed test)
→ 1 directly: Aspire.Hosting.Azure.EntraId.Tests

🧪 tests/Aspire.Hosting.Azure.EntraId.Tests/Snapshots/EntraIdPolyglotTests.OwnersAndRedirects_PreserveDeferredValuesAndOrder.verified.bicep (changed test)
→ 1 directly: Aspire.Hosting.Azure.EntraId.Tests

🧪 tests/Aspire.Hosting.Azure.EntraId.Tests/Snapshots/EntraIdPolyglotTests.Redirects_KeepEndpointValuesDeferred_operation=Publish.verified.bicep (changed test)
→ 1 directly: Aspire.Hosting.Azure.EntraId.Tests

🧪 tests/Aspire.Hosting.Azure.EntraId.Tests/Snapshots/EntraIdPolyglotTests.Redirects_KeepEndpointValuesDeferred_operation=Run.verified.bicep (changed test)
→ 1 directly: Aspire.Hosting.Azure.EntraId.Tests

Job reasons

Job Triggered by
polyglot • .github/workflows/polyglot-validation/test-rust.sh, tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/Go/apphost.go, tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/Go/aspire.config.json, tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/Go/go.mod, tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/Java/AppHost.java, tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/Java/aspire.config.json, tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/Python/apphost.py, tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/Python/apphost_requirements.txt, tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/Python/aspire.config.json, tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/Python/pylock.apphost.toml, tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/Rust/Cargo.lock, tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/Rust/Cargo.toml, tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/Rust/apphost.rs, tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/Rust/aspire.config.json, tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/TypeScript/apphost.mts, tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/TypeScript/aspire.config.json, tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/TypeScript/package-lock.json, tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/TypeScript/package.json, tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/TypeScript/tsconfig.json
• affected project Aspire.Hosting.Azure.EntraId
typescript-api-compat affected project Aspire.Hosting.Azure.EntraId

Selection computed for commit 065b47c.

@eerhardt
Eric Erhardt (eerhardt) marked this pull request as ready for review October 28, 2026 22:19

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.

🟢 Approval recommended

There are no active review findings requiring changes to the Entra ID polyglot integration.

No open issues 🎉

1 resolved since last review
1 file not reviewed
  • tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/TypeScript/package-lock.json: Generated file

Review effort: Balanced

@eerhardt

Copy link
Copy Markdown
Member Author

PR Testing Report

PR Information

Artifact Version Verification

  • Expected Commit: 065b47c
  • Installed Version: 17.0.0-pr.21361.g065b47c8 (PR dogfood CLI and packages from CI run 40778729122)
  • Status: ✅ Verified

Changes Analyzed

  • Hosting: Aspire.Hosting.Azure.EntraId exports (addEntraIdApplication, addExistingEntraApplication, scopes, API permissions, admin consent, redirect URIs, credentials, withReference/withEntraIdReference).
  • Tests and polyglot fixtures (TypeScript, Go, Java, Python, Rust).

Test Scenarios Executed

Scenario 1: TypeScript AppHost for an existing Entra sample app

Objective: Replace the C# AppHost of a Microsoft.Identity.Web sample (Blazor web frontend calling a protected API; both stay .NET projects) with a TypeScript apphost.mts and configure the Entra registrations from TypeScript.
Coverage Type: Happy path (local run)
Status: ✅ Passed

Steps:

  1. Restored the TS AppHost with the PR CLI; tsc --noEmit passed against the generated SDK.
  2. TS AppHost used: addEntraIdApplication, withScope, withApiPermissions, withAdminConsent, publishWithFederatedManagedIdentityCredential, withClientSecret(parameter) (run mode only, via executionContext().isRunMode()), withRedirectUris(endpoint, { callbackPaths }), withReference.
  3. aspire start --isolated, then aspire wait/describe.
  4. Inspected the registrations created in the test tenant and the resource environment variables.
  5. Signed in through the browser and opened the Weather page, which calls the API.

Observations:

  • Both registrations were created with the expected configuration: API registration has api://<clientId> and the access_as_user scope; web registration has the redirect URIs /signin-oidc and /signout-callback-oidc, the API permission, and a tenant-wide (AllPrincipals) consent grant for access_as_user.
  • Web resource received AzureAd__* and DownstreamApis__apiservice__Scopes__0=api://<apiClientId>/access_as_user; API received AzureAd__ClientId, AzureAd__Scopes=access_as_user.
  • With a valid client secret supplied as the web-client-secret parameter, sign-in succeeded and the Weather page returned data from the API (confirmed by the PR author running the app).

Scenario 2: Deploy the TypeScript AppHost to Azure Container Apps

Objective: Deploy the same AppHost and check the published registrations and configuration.
Coverage Type: Happy path (deploy)
Status: ✅ Passed (deployment was run by the PR author; I verified the result read-only)

Observations:

  • Deployment created the container app environment, registry, managed identity, apiservice (internal ingress) and webfrontend (external ingress), both Running.
  • Deployed web registration: redirect URIs use the container app FQDN, a federated identity credential exists, the API permission points at the API registration, and it has no client secret or certificate.
  • webfrontend container env: AzureAd__ClientCredentials__0__SourceType=SignedAssertionFromManagedIdentity with the managed identity client ID, DownstreamApis__apiservice__Scopes__0=api://<apiClientId>/access_as_user.
  • API registration: api://<clientId> and access_as_user.
  • Unauthenticated GET /weather returns a 302 to the Entra authorize endpoint with the deployed registration's client_id.
  • The signed-in Weather page on the deployed app was confirmed working by the PR author; I did not drive that browser flow myself.

Findings (none attributed to the PR)

  • TS launch profile: a TypeScript AppHost selected the http launch profile, so getEndpoint("https") failed with "endpoint https is not defined". Fixed by passing { launchProfileName: "https" } to addDotnetProject.
  • Unsuffixed registration name: deploying a registration named exactly webfrontend-entra failed in this tenant with The language expression property 'appId' doesn't exist on the service principal. It reproduced with a plain az deployment group create of the exported template, without Aspire, while the same template with a tenant resource suffix succeeded. Cause not determined; worked around with Azure:TenantResourceSuffix.
  • Run-mode credential: a new registration has no run-mode credential, so the first sign-in failed with AADSTS700027; resolved by using a client secret parameter (withClientSecret). An invalid secret value produced AADSTS7000215 as expected.
  • CLI mismatch: running aspire deploy with an installed 13.6.4 CLI against PR 17.0 packages failed with MissingMethodException in validate-azure-login; using the PR CLI/matching packages avoids it.

Not covered

  • Unhappy-path scenarios (invalid permission names or IDs, missing configuration) were not run against the live app; they are covered by unit tests in the PR.
  • Only the TypeScript AppHost was exercised live; Go, Java, Python and Rust are covered by compile checks of the fixtures.
  • Microsoft.Identity.Web usage in non-.NET apps was out of scope.

Summary

Scenario Status Notes
TypeScript AppHost, local run ✅ Passed Registrations, configuration flow, sign-in and API call verified
Deploy to Azure Container Apps ✅ Passed Registrations and container config verified read-only; deploy run by author

Overall Result

✅ PR VERIFIED for the TypeScript AppHost scenario; no defects found in the PR.

@eerhardt
Eric Erhardt (eerhardt) merged commit 759b89f into main Oct 28, 2026
63 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 17.0 milestone Oct 28, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Pull request created: #1973

Generated by PR Documentation Check · copilot · auto · 31.1 AIC · ⌖ 1.17 AIC · ⊞ 7.1K

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

📝 Documentation has been drafted in microsoft/aspire.dev#1973 targeting release/17.0.

Added a new Microsoft Entra ID integration page (integrations/security/entra-id.mdx) and sidebar entry covering polyglot AppHost usage. Signals: integration_readme_changed (EntraId README), new_public_type (EntraIdApplicationResource), pr_body_has_cli_flag_mention.

Note

This draft PR needs human review before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-integrations Issues pertaining to Aspire Integrations packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Export the Entra hosting integration to polyglot AppHosts

3 participants