Skip to content

Fix Entra ID settings not saved when authorization fails - #3953

Draft
karmegams02 wants to merge 4 commits into
dotnet:mainfrom
karmegams02:EntraID_3092145
Draft

karmegams02 wants to merge 4 commits into
dotnet:mainfrom
karmegams02:EntraID_3092145

Conversation

@karmegams02

@karmegams02 karmegams02 commented Nov 6, 2026 •

Copy link
Copy Markdown

Description:

Save settings for an existing Entra ID application before running the authorization step.

Rootcause:

The authorization step ran before saving settings. If authorization failed, the process stopped without saving the settings.

Before fix:

Settings were not saved when authorization failed, even when using an existing application.

After fix:

  • For existing applications, save settings before authorization.
  • For new applications, save settings after authorization and secret creation.
  • Stop later steps when a step fails.
  • Run the settings step only once in each successful run.

Test:

All 8 tests passed. The tests use the real scaffolding runner and check:

  • Existing application settings are saved even if authorization fails.
  • New application settings stay unchanged if authorization fails.
  • The settings step runs once when successful.
  • Later steps do not run if saving settings fails.
  • No settings are written if the signed-in identity does not match.

@karmegams02 karmegams02 changed the title Entra id 3092145 Fix Entra ID settings not saved when authorization fails Nov 6, 2026
…o EntraID_3092145

# Conflicts:
#	test/dotnet-scaffolding/dotnet-scaffold.Tests/AspNet/Integration/EntraId/EntraIdTenantIdentityPipelineTests.cs

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 were identified for the change to persist existing application settings before authorization.

No open issues 🎉

What changed in this PR

This PR updates the Entra ID scaffolding pipeline so settings for existing applications are saved before authorization, preserving them if authorization fails. New applications retain settings persistence after authorization and secret creation.

Changes:

  • Add registration-mode filtering to the settings step.
  • Schedule settings updates separately for existing and new applications.
  • Extend pipeline tests for persistence, failure handling, and exactly-once settings execution.
File Description
test/​dotnet-scaffolding/​dotnet-scaffold.Tests/​AspNet/​Integration/​EntraId/​EntraIdTenantIdentityPipelineTests.cs Adds persistence and failure-path tests; updates ordering and identity-mismatch coverage.
src/​dotnet-scaffolding/​dotnet-scaffold/​AspNet/​Extensions/​BlazorEntraScaffolderBuilderExtensions.cs Adds an optional registration-mode filter to the settings step.
src/​dotnet-scaffolding/​dotnet-scaffold/​AspNet/​AspNetCommandService.cs Places settings updates before authorization for existing applications and after secret creation for new applications.

Review effort: Balanced

…o EntraID_3092145

# Conflicts:
#	src/dotnet-scaffolding/dotnet-scaffold/AspNet/AspNetCommandService.cs
#	test/dotnet-scaffolding/dotnet-scaffold.Tests/AspNet/Integration/EntraId/EntraIdTenantIdentityPipelineTests.cs
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