Repository navigation
Enable secretless OBO authentication in DAB using Workload Identity Federation - #3880
Open
Mohit G (gmohit21) wants to merge 2 commits into
Open
Mohit G (gmohit21) wants to merge 2 commits into
Mohit G (gmohit21) wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The security-sensitive federation flow warrants final human review of Azure trust configuration and token lifecycle behavior.
No open issues 🎉
What changed in this PR
Adds secretless Azure SQL On-Behalf-Of authentication through managed identity federation, addressing the federation option requested in #3641 while preserving client-secret support and delegated user identity.
Changes:
- Adds a reusable credential factory that supplies managed-identity assertions to MSAL, with cancellation and sanitized failure handling.
- Shares credential validation between startup and runtime configuration, requiring exactly one credential method.
- Adds tests for credential selection, token requests, failure handling, and startup registration, plus environment-variable documentation.
| File | Description |
|---|---|
| src/Service/Startup.cs | Registers OBO services through the shared credential factory. |
| src/Service.Tests/UnitTests/StartupTests.cs | Tests registration and startup credential validation. |
| src/Service.Tests/UnitTests/ConfigValidationUnitTests.cs | Expands validation coverage for both credential methods. |
| src/Service.Tests/Authentication/OboCredentialFactoryTests.cs | Tests assertions, credential reuse, cancellation, and sanitized failures. |
| src/Core/Configurations/RuntimeConfigValidator.cs | Shares credential validation and deduplicates process-wide errors. |
| src/Core/AuthenticationHelpers/OboCredentialFactory.cs | Implements client-secret and managed-identity federation credentials. |
| src/Config/ObjectModel/DataSource.cs | Defines and documents the managed-identity environment variable. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why make this change?
Related to #3641.
Existing Azure SQL On-Behalf-Of (OBO) authentication requires an application client secret. This change adds a secretless alternative using managed identity federation, reducing secret-management overhead while preserving the caller's delegated SQL identity and existing client-secret configurations.
What is this change?
DAB_OBO_MANAGED_IDENTITY_CLIENT_IDto select a user-assigned managed identity as the OBO application credential.OboCredentialFactory, which acquires a managed-identity token forapi://AzureADTokenExchange/.defaultand supplies it through MSAL's asynchronous client-assertion callback. The caller's access token remains the separate OBO user assertion.The federation option uses a same-tenant user-assigned managed identity on Azure public cloud, with a federated identity credential configured on the API app registration. Existing client-secret deployments remain supported. No new JSON configuration properties or CLI flags are introduced, and the existing SQL permissions/RLS model is unchanged.
How was this tested?
Manual Azure integration validation
Local automated validation
The focused unit/regression suite passed 142 tests, with 0 failures and 0 skipped tests. Coverage includes credential selection, missing/conflicting configuration, separate application and user assertions, assertion reacquisition, cancellation, sanitized failures, startup registration and existing OBO regressions.
The full solution build passed with 0 warnings and 0 errors.
Commands executed from the repository root:
Sample Request(s)
On an Azure host with the user-assigned managed identity attached, federated trust configured, and the existing OBO configuration and SQL permissions in place:
The API request contract is unchanged. For an existing configured
Salaryentity:Authenticate the request using the caller's DAB-audience access token with bearer authentication. Federation changes how DAB authenticates its application identity during the OBO exchange; SQL access continues to use the delegated user's identity and permissions.