Skip to content

Add polyglot support for Azure Entra ID hosting - #21292

Closed
Sébastien Ros (sebastienros) wants to merge 2 commits into
mainfrom
sebros/entra-polyglot-exports
Closed

Sébastien Ros (sebastienros) wants to merge 2 commits into
mainfrom
sebros/entra-polyglot-exports

Conversation

@sebastienros

Copy link
Copy Markdown
Contributor

Description

Enable Entra ID application registrations and authentication configuration in TypeScript, Python, Go, Java, and Rust AppHosts. This is a follow-up to merged #21227, which is already included in the base branch; it does not modify that PR.

Remove the blanket ATS exclusion and export the complete extension-method surface. Literal/parameter and redirect-URI variants have distinct export names. One internal nullable union adapter covers federation for all consumers, a compute resource, or a user-assigned identity, while preserving all existing C# overloads.

Add credential factories for certificate files, signed assertion files, and federated credentials with token exchange overrides. Credentials remain opaque handles and secret passwords remain parameter resources. Implement custom withReference dispatch so ordinary references inject Entra configuration, and expose withEntraIdReference explicitly as well.

Add per-integration fixtures for all five languages, including the first Rust integration fixture and compilation in the existing Rust validation runner. Route Entra package changes to polyglot validation; the existing fixture-directory rule covers all new files. Add focused behavioral coverage for dispatch, credentials, and CI routing, not assertions on generated source shape.

User-facing usage

Existing C# AppHosts continue to work unchanged:

var entra = builder.AddExistingEntraApplication("entra", tenant, client)
    .WithClientSecret(secret);
builder.AddContainer("web", "my-web-image").WithReference(entra);

TypeScript AppHosts can now use the same configuration:

const entra = await builder.addExistingEntraApplicationFromParameters("entra", tenant, client)
    .withClientSecret(secret);
await builder.addContainer("web", "my-web-image").withReference(entra);

const credential = await builder.createEntraIdFileCertificateCredential(
    "/certificates/web.pfx", { password: secret });
await entra.withCredential(credential);

Validation

Run from the repository root unless a fixture-directory change is shown.

Passed: both builds, including export analyzers, with zero warnings and errors:

dotnet build src/Aspire.Hosting.Azure.EntraId/Aspire.Hosting.Azure.EntraId.csproj --nologo -v:q /p:SkipNativeBuild=true
dotnet build src/Aspire.Cli/Aspire.Cli.csproj --nologo -v:q /p:SkipNativeBuild=true

Passed: SDK generation for all five fixtures with the source CLI and local project references:

root="$PWD"
for spec in TypeScript/apphost.mts Python/apphost.py Go/apphost.go Java/AppHost.java Rust/apphost.rs; do
    (cd "tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/$(dirname "$spec")" &&
        ASPIRE_REPO_ROOT="$root" dotnet run --no-build --project "$root/src/Aspire.Cli/Aspire.Cli.csproj" -- restore --non-interactive --apphost "$(basename "$spec")") || exit
done

Passed: TypeScript compilation with both checkers:

cd tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/TypeScript
npx tsc --noEmit
npx --yes @typescript/native-preview --noEmit --project tsconfig.json

Passed: Python type checking (zero errors/warnings), plus compilation of the AppHost and generated SDK:

cd tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/Python
PYTHONPATH="$PWD/.aspire/modules" npx --yes pyright --project ../../../../.github/workflows/polyglot-validation/pyrightconfig.json --pythonpath "$(command -v python3)" apphost.py
python3 -c "from pathlib import Path; files = [Path('apphost.py'), *Path('.aspire/modules').rglob('*.py')]; [compile(f.read_text(), str(f), 'exec') for f in files]; print(f'Compiled {len(files)} Python files')"

Passed: Go, Java 25, and Rust compilation:

cd tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/Go
go build -buildvcs=false ./...
cd ../Java
javac --enable-preview --source 25 -d .aspire/compiled @.aspire/modules/sources.txt AppHost.java
cd ../Rust
cargo check --quiet

Passed: 14 Entra behavior cases and 6 CI routing cases:

dotnet test --project tests/Aspire.Hosting.Azure.EntraId.Tests/Aspire.Hosting.Azure.EntraId.Tests.csproj --no-launch-profile -- --filter-method '*.Polyglot*' --filter-method '*.WithReference_BindsToMicrosoftIdentityWebOptions' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'
dotnet test --project tests/Infrastructure.Tests/Infrastructure.Tests.csproj --no-launch-profile -- --filter-method '*.RealMapEntraFixturesAndIntegrationRunPolyglotValidation' --filter-method '*.RealMapEveryPolyglotFixtureConsumerRunsPolyglotValidation' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'

The Entra test restore reported existing NU1902/NU1903 advisories for its Microsoft.Identity.Web transitive cryptography dependencies; this PR does not change those dependencies.

Passed: live TypeScript-to-ATS execution of the fixture, including credential handles, references, and all federation argument variants, without calling build().run(). The CLI log recorded Entra ID model configured without provisioning. and exit code 0:

root="$PWD"
cd tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/TypeScript
ASPIRE_REPO_ROOT="$root" ENTRA_ID_VALIDATE_MODEL_ONLY=1 dotnet run --no-build --project "$root/src/Aspire.Cli/Aspire.Cli.csproj" -- run --non-interactive --apphost apphost.mts

Passed: bash -n .github/workflows/polyglot-validation/test-rust.sh and git diff --check.

No cloud deployment was run and no Azure/Entra objects were created. Graph provisioning, managed identity token exchange, certificate retrieval, and deployed workload authentication remain unvalidated. Local SDK compilation and model-only execution do not establish cloud runtime compatibility. Docker/Linux CI and the Rust runner's existing Redis runtime scenario were not run locally; the Rust CI job retains its existing advisory status.

Security considerations

The new ATS surface exposes existing Entra credential and federation configuration to trusted AppHost code. It delegates to existing validation and provisioning behavior, keeps certificate passwords in secret parameters, and does not add default trust, bypass existing-registration restrictions, or configure workload authentication middleware.

Fixes: N/A (no linked issue; follows merged #21227).

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

Export Entra configuration through ATS, preserve CLR overloads with focused adapters, and exercise all five polyglot SDKs.

Co-authored-by: Copilot App <[email protected]>
@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 -- 21292

Or

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

@aspire-repo-bot
aspire-repo-bot Bot requested a balanced review from Copilot October 23, 2026 17:10
@github-actions github-actions Bot added the area-integrations Issues pertaining to Aspire Integrations packages label Oct 23, 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.

🔵 Needs a closer look

The credential and federation exports span five language SDKs and warrant human review given the documented cloud-runtime and Docker/Linux validation limits.

No open issues 🎉

1 file not reviewed
  • tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/TypeScript/package-lock.json: Generated file
What changed in this PR

Extends the existing Azure Entra ID hosting integration to TypeScript, Python, Go, Java, and Rust AppHosts, building on the federation support from #21227 while preserving existing C# overloads.

Changes:

  • Exports Entra configuration APIs, credential factories, federation dispatch, and resource-specific references.
  • Adds five-language fixtures and behavioral tests for reference dispatch, credentials, and CI routing.
  • Enables polyglot package discovery, adds Rust fixture compilation, and documents usage.
File Description
tests/​PolyglotAppHosts/​Aspire.Hosting.Azure.EntraId/​TypeScript/​tsconfig.json Configures strict fixture type checking.
tests/​PolyglotAppHosts/​Aspire.Hosting.Azure.EntraId/​TypeScript/​package.json Declares TypeScript fixture dependencies.
tests/​PolyglotAppHosts/​Aspire.Hosting.Azure.EntraId/​TypeScript/​package-lock.json Locks TypeScript fixture dependencies.
tests/​PolyglotAppHosts/​Aspire.Hosting.Azure.EntraId/​TypeScript/​aspire.config.json Selects the TypeScript AppHost and Entra integration.
tests/​PolyglotAppHosts/​Aspire.Hosting.Azure.EntraId/​TypeScript/​apphost.mts Exercises exports with a model-only execution option.
tests/​PolyglotAppHosts/​Aspire.Hosting.Azure.EntraId/​Rust/​Cargo.toml Defines the Rust fixture and dependencies.
tests/​PolyglotAppHosts/​Aspire.Hosting.Azure.EntraId/​Rust/​Cargo.lock Locks Rust fixture dependencies.
tests/​PolyglotAppHosts/​Aspire.Hosting.Azure.EntraId/​Rust/​aspire.config.json Enables the Rust AppHost and Entra integration.
tests/​PolyglotAppHosts/​Aspire.Hosting.Azure.EntraId/​Rust/​apphost.rs Exercises Entra APIs through the Rust SDK.
tests/​PolyglotAppHosts/​Aspire.Hosting.Azure.EntraId/​Python/​pylock.apphost.toml Locks the generated Python SDK dependency.
tests/​PolyglotAppHosts/​Aspire.Hosting.Azure.EntraId/​Python/​aspire.config.json Enables the Python AppHost and Entra integration.
tests/​PolyglotAppHosts/​Aspire.Hosting.Azure.EntraId/​Python/​apphost.py Exercises Entra APIs through the Python SDK.
tests/​PolyglotAppHosts/​Aspire.Hosting.Azure.EntraId/​Python/​apphost_requirements.txt References the generated Python SDK.
tests/​PolyglotAppHosts/​Aspire.Hosting.Azure.EntraId/​Java/​aspire.config.json Enables the Java AppHost and Entra integration.
tests/​PolyglotAppHosts/​Aspire.Hosting.Azure.EntraId/​Java/​AppHost.java Exercises Entra APIs through the Java SDK.
tests/​PolyglotAppHosts/​Aspire.Hosting.Azure.EntraId/​Go/​go.mod References the generated local Go SDK.
tests/​PolyglotAppHosts/​Aspire.Hosting.Azure.EntraId/​Go/​aspire.config.json Enables the Go AppHost and Entra integration.
tests/​PolyglotAppHosts/​Aspire.Hosting.Azure.EntraId/​Go/​apphost.go Exercises Entra APIs through the Go SDK.
tests/​Infrastructure.Tests/​TestTriggerMap/​SelectTestsAcceptanceTests.cs Tests Entra package and fixture CI routing.
tests/​Aspire.Hosting.Azure.EntraId.Tests/​MicrosoftIdentityWebConfigurationTests.cs Exercises credential factories in configuration-binding tests.
tests/​Aspire.Hosting.Azure.EntraId.Tests/​EntraIdResourceBuilderTests.cs Tests reference dispatch, federation targets, and password validation.
src/​Aspire.Hosting.Azure.EntraId/​README.md Documents polyglot references, overloads, and credentials.
src/​Aspire.Hosting.Azure.EntraId/​EntraIdResourceExtensions.cs Adds exports, credential factories, and a federation adapter.
src/​Aspire.Hosting.Azure.EntraId/​EntraIdApplicationResource.cs Adds custom reference dispatch and exports credential handles.
src/​Aspire.Hosting.Azure.EntraId/​Aspire.Hosting.Azure.EntraId.csproj Removes the polyglot compatibility opt-out.
eng/​github-ci/​test-trigger-map.yml Routes Entra package changes to polyglot validation.
.github/​workflows/​polyglot-validation/​test-rust.sh Compiles Rust integration fixtures without provisioning.

Review effort: Balanced

Add targeted ATS XML documentation overrides for credential handles, federation options, parameter variants, redirect URIs, and reference configuration while preserving C# documentation.

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 26 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/EntraIdResourceBuilderTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Azure.EntraId.Tests

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

🧪 tests/Infrastructure.Tests/TestTriggerMap/SelectTestsAcceptanceTests.cs (changed test)
→ 1 directly: Infrastructure.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 a0058d3.

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.

🔵 Needs a closer look

The authentication surface now spans five generated SDKs, while cloud runtime and Docker/Linux CI validation remain incomplete and warrant human review.

No open issues 🎉

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

Review effort: Balanced

@sebastienros

Copy link
Copy Markdown
Contributor Author

PR testing report

PR information

  • PR: Add polyglot support for Azure Entra ID hosting #21292
  • Title: Add polyglot support for Azure Entra ID hosting
  • Head tested: a0058d39e01979d1c682db5ac80a7da42477a72d
  • Tested: 2026-10-23, macOS ARM64
  • Scope approved: local TypeScript validation and Azure publish artifacts only. No Azure or Entra resources were created.

Artifact version verification

Installed the dogfood CLI into an isolated temporary directory using:

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh |
  bash -s -- 21292 --install-path "$testDir/cli" --skip-path --skip-extension

The installed binary reported 17.0.0-pr.21292.ga0058d39, matching the PR head.
Downloaded artifacts came from CI run 39994635273, whose head SHA also matched.
Every test project used the downloaded PR packages, not source project references.
The PR head was checked again after testing and remained unchanged.

Changes analyzed

  • Hosting: Entra ATS exports, credential factories, federation dispatcher, and custom reference dispatch.
  • Tests: TypeScript/Python/Go/Java/Rust fixtures and focused Entra/selector tests.
  • CI: Rust fixture compilation and production-project routing to polyglot validation.
  • Documentation: ATS-specific documentation and integration README.
  • No CLI, dashboard, client component, template, or VS Code extension source changes.

Test scenarios executed

Scenario Result Evidence
Fresh TypeScript AppHost and generated SDK Passed PR template creation, integration installation, npx tsc --noEmit
Full Entra model published for Azure Container Apps Passed publish.log; all 14 pipeline steps succeeded
Generated artifact/reference/federation wiring Passed publish/ and explicit artifact checks
Local existing-registration runtime Passed Both Entra resources reached Running/Healthy; local-resources.json
Invalid literal client ID Passed: safely rejected invalid-client.log, ATS INVALID_ARGUMENT, exit 6
Non-secret certificate password Passed: safely rejected nonsecret-password.log, ATS INVALID_ARGUMENT, exit 6
Federation provisioning on existing registration Passed: safely rejected existing-federation.log, explanatory ATS error, exit 6
Rust CI fixture and existing Redis scenario Passed rust-ci-evidence.log

Fresh project setup

Created a new project for each scenario using the PR's template hive:

"$cli" new aspire-ts-empty --name EntraScenario --output "$scenarioDir" \
  --source "$testDir/cli/hives/pr-21292/packages" \
  --version 17.0.0-pr.21292.ga0058d39 \
  --localhost-tld false --suppress-agent-init --non-interactive
"$cli" add Aspire.Hosting.Azure.EntraId --non-interactive
"$cli" add Aspire.Hosting.Azure.AppContainers --non-interactive

The comprehensive TypeScript test AppHost is preserved as apphost.mts.
It exercises literal and parameter factories, conversions to existing registrations, all redirect/owner variants,
all credential convenience methods, all three advanced credential factories, both reference paths,
and all three federation dispatcher branches.

Publish

Ran in the fresh comprehensive AppHost directory:

npx tsc --noEmit
Azure__SubscriptionId="<sebros dev subscription>" \
Azure__Location=westus2 \
Azure__ResourceGroup=rg-entra-pr21292-preview-1792779000 \
Parameters__tenant=contoso.onmicrosoft.com \
Parameters__client=00000000-0000-0000-0000-000000000001 \
Parameters__secret=placeholder-not-a-real-credential \
Parameters__owner=00000000-0000-0000-0000-000000000001 \
Parameters__redirect=https://example.com/signin-oidc \
Parameters__host=example.com \
"$cli" publish --apphost apphost.mts --output-path "$testDir/publish" --non-interactive

The subscription was resolved read-only from the Azure CLI's existing login context.
The randomly named resource group was a preview input only: it was not created.
All parameter values were synthetic, and no real credentials were supplied.

Verified:

  • Exact module inventory: aca-acr, aca, created, targeted, identity, shared, web.
  • All-consumer, targeted-compute, and explicit-identity federation emit Graph federated identity credentials with the managed identity principal ID as subject.
  • All three resolve the shared identity configured on the compute resource.
  • Literal, parameter, endpoint, and host callback URI variants flow into the Graph registration module and root module expressions.
  • Owner arrays and ID-token issuance flow into the registration/service-principal configuration.
  • Ordinary withReference and explicit withEntraIdReference emit the expected five distinct environment prefixes.
  • Certificate paths, signed assertion settings, and token exchange overrides reach workload configuration.
  • Client secrets and certificate passwords use secure Bicep parameters and Container Apps secret references.
  • Existing/converted registrations do not produce Graph registration modules.

Local runtime

The local scenario adds only existing registrations and parameter resources; it does not add an Azure deployment environment,
new registrations, identities, or containers.

ENTRA_TEST=local \
Parameters__tenant=contoso.onmicrosoft.com \
Parameters__client=00000000-0000-0000-0000-000000000001 \
Parameters__secret=placeholder-not-a-real-credential \
"$cli" start --apphost apphost.mts --isolated --format Json --non-interactive
"$cli" wait existing --status up --timeout 60 --apphost apphost.mts --non-interactive
"$cli" wait parameterized --status up --timeout 60 --apphost apphost.mts --non-interactive
"$cli" describe --apphost apphost.mts --format Json --non-interactive
"$cli" stop --apphost apphost.mts --non-interactive

Both Entra resources reported Running / Healthy. Metadata showed the configured credential types and sovereign-cloud URLs.
The secret parameter value was redacted (null) in structured resource output.
The AppHost stopped successfully.
This demonstrates configuration/model initialization, not authentication against the synthetic registration.

Negative cases

Each fresh scenario ran:

ENTRA_TEST="<case>" "$cli" publish --apphost apphost.mts --non-interactive
  • invalid-client: not-a-guid rejected with a client-ID explanation and INVALID_ARGUMENT.
  • nonsecret-password: ordinary parameter rejected with “The certificate password parameter must be marked as secret” and INVALID_ARGUMENT.
  • existing-federation: attempt to provision trust on an existing registration rejected with guidance to configure trust externally and use withFederatedManagedIdentityCredential. The dispatcher reports this invalid operation as INTERNAL_ERROR; the existing-registration protection remains enforced.
  • All three exited 6 and produced no publish artifacts or cloud resources.

Harness corrections

The initial fresh template had no tsconfig.json; an explicit strict NodeNext validation config was added before type checking.
The first publish correctly rejected unresolved parameters in non-interactive mode; rerunning with synthetic inputs passed.
Initial negative-scenario attempts lacked the AppContainers SDK used by the shared test source and stopped at type checking;
the missing integration was added, and every negative case was rerun to confirm the intended ATS validation error.
These setup failures were not counted as scenario passes.

CI infrastructure validation

The changed Rust script is copied into the Rust container and executed by polyglot-validation.yml,
called through tests.yml from ci.yml. Test-trigger-map routing selected that job on this PR.
There are no changed action pins, gh-aw generated locks, artifact producers, or Azure DevOps pipelines.

Inspected the actual Rust job log, not just its advisory job conclusion:

=== Rust SDK fixture: Aspire.Hosting.Azure.EntraId ===
Checking entra-id-polyglot-validation v0.1.0 (/workspace/tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/Rust)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 5.42s
SUCCESS: Redis container is running!

The new fixture was compiled and the pre-existing Redis runtime scenario still executed.
The same head's Infrastructure, Entra hosting, Go, Python, Java, TypeScript (Node 22/24), and API-compatibility CI jobs passed.
Focused selector tests had already passed locally and Infrastructure tests passed in this run; no redundant rerun was needed.
No manual dispatch was necessary because the affected workflow ran on the PR.

Overall result

Passed for the approved scope: the latest packaged PR TypeScript SDK supports the new methods,
local existing-registration initialization works, and Azure publish produces the expected identity,
Graph registration, redirect, ownership, credential, and reference wiring.

Not validated: Azure deployment/Bicep application, real Microsoft Graph permissions, actual registration creation,
managed identity token exchange, certificate/Key Vault retrieval, workload authentication, and deployed endpoints.
The user explicitly chose publish-only testing; no Azure/Entra objects were created.

Artifacts and cleanup

The report, test AppHost, publish artifacts, sanitized structured runtime state, and scenario/CI logs are preserved in the session Library area.
The temporary CLI installation and generated scenario workspaces are removed after evidence capture.
No repository files were modified by this test run.

@eerhardt

Copy link
Copy Markdown
Member

Superseded by #21361

Eric Erhardt (eerhardt) added a commit that referenced this pull request Oct 28, 2026
## 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:

```csharp
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:

```typescript
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:

```typescript
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:

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

---------

Co-authored-by: Copilot App <[email protected]>
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.

3 participants