Repository navigation
Reject registration-only configuration on existing Entra references - #21493
Conversation
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 -- 21493Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21493" |
Tests selector2 / 100 PR test projects · 2 PR jobs, from 6 changed files. Selected PR test projects (2 / 100)
Selected PR jobs (2)
How these were chosen — grouped by what changed🔧 🔧 🧪 🧪 🧪 🧪 Job reasons
Selection computed for commit |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block approval of the existing-registration configuration changes.
No open issues 🎉
What changed in this PR
Addresses #21256 by rejecting registration-only configuration on existing Entra registrations at configuration time, while preserving consumer settings and explicit API metadata.
Changes:
- Adds consistent, actionable errors and validates incompatible settings before
AsExistingApplicationchanges resource state. - Expands tests across fluent call orders, run/publish modes, and polyglot adapters.
- Updates XML documentation and the README to distinguish registration provisioning from consumer configuration.
| File | Description |
|---|---|
| tests/Aspire.Hosting.Azure.EntraId.Tests/MicrosoftIdentityWebConfigurationTests.cs | Verifies consumer configuration survives conversion to an existing registration. |
| tests/Aspire.Hosting.Azure.EntraId.Tests/EntraIdProvisioningTests.cs | Tests registration-only rejection and unchanged resource state after failures. |
| tests/Aspire.Hosting.Azure.EntraId.Tests/EntraIdPolyglotTests.cs | Covers existing-registration consumer configuration in run and publish modes. |
| tests/Aspire.Hosting.Azure.EntraId.Tests/EntraIdApiProvisioningTests.cs | Tests default URI rejection and preservation of supported API metadata. |
| src/Aspire.Hosting.Azure.EntraId/README.md | Explains supported settings, manual configuration, and provisioning distinctions. |
| src/Aspire.Hosting.Azure.EntraId/EntraIdResourceExtensions.cs | Guards registration-only calls and updates XML and polyglot documentation. |
| src/Aspire.Hosting.Azure.EntraId/EntraIdApplicationResource.cs | Centralizes validation and tracks mode-specific provisioning intent. |
Review effort: Balanced
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Mitch Denny (mitchdenny)
left a comment
There was a problem hiding this comment.
Looks good from a surface-level API and security review. Failing early for registration-only configuration on existing references is clearer than silently ignoring it, and checking before conversion while retaining run/publish-specific configuration intent is a good safeguard. No blocking issues identified in this review.
|
Pull request created: #2027
|
|
📝 Documentation has been drafted in microsoft/aspire.dev#2027 targeting Added a new page Note This draft PR needs human review before merging. |
Description
Registration-only Entra configuration currently accepts existing registrations and silently does nothing, leaving applications to fail later during authentication. Fail at the configuration call instead, with guidance for configuring the registration manually.
Guard redirect URIs, owners, ID-token issuance, pre-authorization, admin consent, and the default application ID URI. Align existing role, certificate, and federation errors, and reject incompatible settings before
AsExistingApplicationchanges resource state. Cover both fluent orders, run/publish modes, and polyglot adapters.Consumer configuration remains supported, including audiences, credentials, explicit API URI/scope metadata, and downstream API permissions. Created registrations can still consent to existing APIs or pre-authorize existing clients. Preserve the distinction between fluent conversion retaining Azure setup and
AddExistingEntraApplicationnot enabling provisioning.Update XML/ATS documentation and the README. No Azure core changes, Key Vault resource-reference changes, or new dependencies.
Fixes #21256
User-facing usage
Describe an existing API using its registered URI; consumer audience configuration remains supported.
Behavior change
Registration-only calls that previously did nothing on existing references now throw
InvalidOperationException.AsExistingApplicationalso rejects registration-only settings applied before conversion, including mode-specific certificate/federation setup. Configure those settings manually on the existing registration and retain only consumer configuration in the AppHost. Existing API references must supply their registered URI rather than call parameterlessWithApplicationIdUri().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"— 628 tests passed.git diff --check.System.Security.Cryptography.XmlNuGet advisory warnings remain. No live Azure deployments or directory/permission changes were performed.Checklist
<remarks />and<code />elements on your triple slash comments?