Repository navigation
Expose Entra Graph provisioning models for ConfigureInfrastructure - #21724
Conversation
Make the Microsoft Graph Azure.Provisioning models public so C# callers can customize the generated Entra application and service principal, for example tags and serviceManagementReference. Add common application and service principal properties, rename FederatedIdentityCredential to MicrosoftGraphFederatedIdentityCredential for consistency, and add the opt-in Aspire.Hosting.Azure.Provisioning.EntraId package that projects the models to polyglot AppHosts through the shared provisioning proxy generator. Co-authored-by: Copilot App <[email protected]>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21724Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21724" |
Tests selectorSelects the full PR test matrix + all PR-gated jobs (ALL) — a rule matching 'Aspire.slnx' selects ALL Selection computed for commit |
There was a problem hiding this comment.
🟡 Changes recommended
Deployment E2E coverage does not verify custom application tags and serviceManagementReference through Graph after deployment and redeployment, or preservation of the required service-principal tag, leaving provider rejection or value loss undetected.
1 open issue
What changed in this PR
Exposes Microsoft Graph provisioning models so C# and polyglot AppHosts can customize Entra registrations through ConfigureInfrastructure, addressing the customization work tracked in #21060.
Changes:
- Makes Graph models public and documented, with additional application and service-principal properties.
- Adds an experimental Entra provisioning package for polyglot customization.
- Adds customization tests, Bicep snapshots, fixture references, and usage documentation.
| File | Description |
|---|---|
| tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/TypeScript/aspire.config.json | References the new provisioning package. |
| tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/TypeScript/apphost.mts | Exercises Graph metadata customization. |
| tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/Python/aspire.config.json | References the new provisioning package. |
| tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/Java/aspire.config.json | References the new provisioning package. |
| tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/Go/aspire.config.json | References the new provisioning package. |
| tests/Aspire.Hosting.Azure.EntraId.Tests/Snapshots/EntraIdProvisioningTests.ConfigureInfrastructure_CustomizesApplicationMetadata.verified.bicep | Records C# customization output. |
| tests/Aspire.Hosting.Azure.EntraId.Tests/Snapshots/EntraIdPolyglotTests.ConfigureInfrastructure_ProxiesCustomizeGraphResources.verified.bicep | Records proxy customization output. |
| tests/Aspire.Hosting.Azure.EntraId.Tests/EntraIdProvisioningTests.cs | Tests C# customization and parameter binding. |
| tests/Aspire.Hosting.Azure.EntraId.Tests/EntraIdPolyglotTests.cs | Tests exported proxies and Bicep expressions. |
| tests/Aspire.Hosting.Azure.EntraId.Tests/Aspire.Hosting.Azure.EntraId.Tests.csproj | Adds the provisioning package test reference. |
| src/Aspire.Hosting.Azure.Provisioning/README.md | Lists Entra provisioning support. |
| src/Aspire.Hosting.Azure.Provisioning.EntraId/README.md | Documents installation and TypeScript usage. |
| src/Aspire.Hosting.Azure.Provisioning.EntraId/AtsTypeMappings.cs | Registers Graph models for proxy generation. |
| src/Aspire.Hosting.Azure.Provisioning.EntraId/Aspire.Hosting.Azure.Provisioning.EntraId.csproj | Defines the experimental provisioning package. |
| src/Aspire.Hosting.Azure.EntraId/README.md | Documents C# and TypeScript customization. |
| src/Aspire.Hosting.Azure.EntraId/Provisioning/MicrosoftGraphServicePrincipal.cs | Exposes models and adds service-principal properties. |
| src/Aspire.Hosting.Azure.EntraId/Provisioning/MicrosoftGraphPermissionGrants.cs | Exposes and documents permission-grant models. |
| src/Aspire.Hosting.Azure.EntraId/Provisioning/MicrosoftGraphKeyCredential.cs | Exposes and documents certificate credentials. |
| src/Aspire.Hosting.Azure.EntraId/Provisioning/MicrosoftGraphFederatedIdentityCredential.cs | Renames, exposes, and documents federated credentials. |
| src/Aspire.Hosting.Azure.EntraId/Provisioning/MicrosoftGraphAppRole.cs | Exposes and documents application roles. |
| src/Aspire.Hosting.Azure.EntraId/Provisioning/MicrosoftGraphApplication.cs | Exposes the application model and adds schema-backed properties. |
| src/Aspire.Hosting.Azure.EntraId/Provisioning/MicrosoftGraphApiConstructs.cs | Exposes and documents nested permission models. |
| src/Aspire.Hosting.Azure.EntraId/Provisioning/EntraIdApiProvisioning.cs | Adds explanatory links to the existing workaround comment. |
| src/Aspire.Hosting.Azure.EntraId/EntraIdApplicationResource.cs | Uses the renamed federated credential model. |
| Aspire.slnx | Includes the new provisioning project. |
Review effort: Balanced
PR Testing ReportPR Information
Artifact Version Verification
Changes AnalyzedThe 25 changed files expose Graph provisioning models, add application/service-principal properties, rename the federated credential model, add the experimental polyglot provisioning overlay, update documentation, and add tests and polyglot fixture references.
Commands and EnvironmentThe following variables describe the exact paths used: $base = 'C:\Users\dapine\.copilot\session-state\9e09f226-e30a-4231-9c45-420bee71add6\files'
$root = "$base\pr-21724-test"
$cli = "$root\dogfood\pr-21724\bin\aspire.exe"
$hive = "$root\hives\pr-21724\packages"
$version = '17.0.0-pr.21724.g95c6ec0c'The installer was invoked from the PR dogfood instructions, with isolation flags: iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21724 -InstallPath $root -SkipExtension -SkipPath"
& $cli --versionBoth succeeded. User profiles and PATH were not modified. Test Scenarios Executed1. Source build and Entra regression testsStatus: Passed, 658 succeeded, 0 failed, 0 skipped. .\restore.cmd
$env:MSBUILDTERMINALLOGGER = 'false'
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"Restore succeeded with 12 NuGet vulnerability warnings. Test execution succeeded in approximately 23 seconds after the build. This includes the new C# customization and ATS-proxy Bicep snapshot tests and existing registration, permission, federation, credential, validation, and default-output tests. Expected failure-path logging appears in the log; the runner's actual summary reports zero failed tests. Evidence: 2. Fresh C# AppHost consumes the PR packageCoverage: Happy path and boundaries. Status: Passed. & $cli new aspire-empty --name EntraCSharp --output "$root\EntraCSharp" --source $hive --version $version --language CSharp --localhost-tld false --suppress-agent-init --use-config-source false --non-interactive
& $cli add Aspire.Hosting.Azure.EntraId --apphost "$root\EntraCSharp\apphost.cs" --version $version --source $hive --non-interactive
$env:ENTRA_TEST_OUTPUT = "$root\csharp-customized.bicep"
& $cli publish --apphost "$root\EntraCSharp\apphost.cs" --output-path "$root\csharp-output" --non-interactive --include-exception-detailsAll commands exited 0. The temporary AppHost exercised every new application/service-principal property, plus ID-token issuance, using literals and a Bicep parameter. It also checked:
Evidence: The publish pipeline's "No azure compute environments found" warning is expected: this app contains only registration resources and intentionally does not deploy compute. 3. Fresh TypeScript AppHost executes generated provisioning APIsCoverage: Happy path, real generated SDK and RPC callbacks. Status: Passed. & $cli new aspire-ts-empty --name EntraTypeScript --output "$root\EntraTypeScript" --source $hive --version $version --localhost-tld false --suppress-agent-init --use-config-source false --non-interactive
& $cli add Aspire.Hosting.Azure.Provisioning.EntraId --apphost "$root\EntraTypeScript\apphost.mts" --version $version --source $hive --non-interactive
& $cli publish --apphost "$root\EntraTypeScript\apphost.mts" --output-path "$root\typescript-output" --non-interactive --include-exception-details
Push-Location "$root\EntraTypeScript"
npm run build
Pop-LocationAll commands exited 0. The AppHost looked up Graph resources by identifier and exercised every new application/service-principal property through generated proxies, including list access, adding both literal and parameter tags, nested redirect collections, notification addresses, and boolean setters. The C# and TypeScript customized modules were compared in full and are byte-for-byte identical, not merely checked for selected substrings. Evidence: 4. Generated Bicep compiles against the pinned Graph extensionStatus: Passed for both C# and TypeScript modules. az bicep version
az bicep build --file "$root\csharp-output\customized\customized.bicep"
az bicep build --file "$root\typescript-output\customized\customized.bicep"Bicep version: Evidence: 5. Missing and wrong-type Graph identifiers fail safelyCoverage: Negative. Status: Passed for nonzero failure behavior; diagnostic quality is limited. foreach ($lookup in @('missing', 'servicePrincipal')) {
$env:TEST_LOOKUP = $lookup
& $cli publish --apphost "$root\EntraTypeScript\apphost.mts" --output-path "$root\negative-$lookup" --non-interactive --include-exception-details
}The app passes the environment value to The error identifies the failing capability, but uses the generic message: This is not a good actionable "resource not found" message. It is reported as a diagnostic limitation rather than a new PR-specific correctness failure: this overlay uses the shared provisioning lookup generator. Evidence: Summary
Overall ResultPassed within the tested scope. No PR-specific functional failure found. Not validated: real Entra tenant deployment, deployed token/sign-in behavior, resource startup/dashboard behavior, Linux/container behavior, or Go/Java/Python generated SDK compilation. No tenant objects were created or modified. Publish validates generation, not Microsoft Graph deployment semantics. The new properties were tested end-to-end from both C# and TypeScript using the final PR artifacts. Source checkout and PR head remained unchanged. Artifacts and CleanupPersistent evidence directory: Logs, generated Bicep/JSON, and temporary AppHost source were copied there before cleanup. No screenshots were needed for this infrastructure-generation-only scenario. The isolated CLI, downloaded hive, and generated project workspace were removed after preserving evidence. Retained evidence and this report are outside that disposable workspace. No surviving processes referenced the test workspace before cleanup. PR Comment StatusThe user explicitly approved posting this report as a PR comment. |
David Pine (IEvangelist)
left a comment
There was a problem hiding this comment.
Reviewed the current diff; no outstanding findings from my review.
|
Pull request created: #2043
|
|
📝 Documentation has been drafted in microsoft/aspire.dev#2043 targeting Updated Note This draft PR needs human review before merging. |

Description
AddEntraIdApplicationis anAzureProvisioningResource, soConfigureInfrastructurecan customize its generated Bicep, but the Microsoft Graph provisioning models it builds were internal. Callers couldn't reach them, for example to add application tags or setserviceManagementReference. This makes those models public for C# and exposes them to polyglot AppHosts.Microsoft Graph tags are a string array, not Azure key/value tags, and
serviceManagementReferenceis a separate string property, so the change exposes those schema-backed properties rather than adding a dedicated API.User-facing usage
C# AppHost:
TypeScript AppHost, with the new experimental
Aspire.Hosting.Azure.Provisioning.EntraIdpackage:What changed
Aspire.Hosting.Azure.EntraId.Provisioningare public and documented: application, service principal, federated credential, permission grants, and the nested scope, role, and credential types.FederatedIdentityCredentialis renamedMicrosoftGraphFederatedIdentityCredentialto match the others and avoid colliding with the Azure.Provisioning type of the same name.Tags,ServiceManagementReference,Description,Notes,GroupMembershipClaims,IsFallbackPublicClient,HomePageUrl,LogoutUrl,EnableAccessTokenIssuance,SpaRedirectUrisandPublicClientRedirectUrison the application, andAccountEnabled,AppRoleAssignmentRequired,Description,NotesandNotificationEmailAddresseson the service principal. Unset properties emit nothing, so existing templates are unchanged.Aspire.Hosting.Azure.Provisioning.EntraIdpackage, following the existing Key Vault and Storage provisioning overlays. It projects the models through the shared proxy generator and Bicep expression runtime, and is experimental like the others.api/*.csbaselines are untouched.Things to know
api://{clientId}URI is emitted as twoMicrosoft.Graph/applicationsdeclarations. The second repeatsDisplayNameandUniqueName, so changing them on only the first is not enough. This is existing behavior and is documented in the XML remarks. It is a workaround for msgraph-bicep-types#239; the code comment now links it.Validation
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, 658 tests. The new tests cover C# customization and the exported ATS proxies; snapshots are generated Bicep.az bicep buildagainst the pinned Graph extension.npm run build). The generated Go SDK builds and the Python SDK compiles. Java and Rust output generated without error but was not compiled.Infrastructure.Teststest-selection tests for the map and graph passed. The broader selector namespace has unrelated Windows failures: Bash receives unquoted Windows paths and git fixture cleanup is denied.Relates to #21060
Checklist
<remarks />and<code />elements on your triple slash comments?