[OBO] Add CLI support for user-delegated authentication configuration#3128
[OBO] Add CLI support for user-delegated authentication configuration#3128anushakolan merged 17 commits intomainfrom
Conversation
Co-authored-by: anushakolan <45540936+anushakolan@users.noreply.github.com>
Co-authored-by: anushakolan <45540936+anushakolan@users.noreply.github.com>
Co-authored-by: anushakolan <45540936+anushakolan@users.noreply.github.com>
…ptions and add provider field Co-authored-by: anushakolan <45540936+anushakolan@users.noreply.github.com>
Aligned CLI implementation with PR #3151 in commit b0f98fe. Changes:
Generated config now matches the schema from PR #3151: {
"user-delegated-auth": {
"enabled": true,
"provider": "EntraId",
"database-audience": "https://database.windows.net"
}
} |
Co-authored-by: anushakolan <45540936+anushakolan@users.noreply.github.com>
|
@copilot make the target branch for this PR to be the branch in PR 3151, So that we won't have duplicate changes. After the PR 3151 is merged, we can merge this PR as well. |
I've rebased the branch onto However, I cannot change the PR base branch through git commands - that must be done in the GitHub UI. Please update the base branch of this PR from Note: The current remote branch state is outdated. To update it with the rebased commits, you'll need to force push manually or I can create a new branch with a different name if preferred. |
|
@copilot this branch should contain changes explicilty related to cli addition, the core implementation branch is https://github.com/Azure/data-api-builder/tree/dev/anushakolan/obo-delegated-identity. I changed the target branch of this PR to https://github.com/Azure/data-api-builder/tree/dev/anushakolan/obo-delegated-identity, so make sure there are no repeated or duplicate code as it will create conflicts. |
…ions - Delete separate UserDelegatedAuthOptions.cs file (already defined in DataSource.cs in base branch) - Add missing IsUserDelegatedAuthEnabled property to DataSource - Add missing UserDelegatedAuthOptions record definition to DataSource.cs - Restore DataSourceConverterFactory.cs to base version (already has user-delegated-auth support) Co-authored-by: anushakolan <45540936+anushakolan@users.noreply.github.com>
- DataSourceConverterFactory.cs already has user-delegated-auth support in base - DataApiBuilderException.cs no changes needed Co-authored-by: anushakolan <45540936+anushakolan@users.noreply.github.com>
- Add assertions to verify default Enabled=false when only database-audience is set - Add assertions to verify default DatabaseAudience=null when only enabled is set - Improve method documentation to clarify JSON structure validation Co-authored-by: anushakolan <45540936+anushakolan@users.noreply.github.com>
|
/azp run |
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
Azure Pipelines successfully started running 6 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
|
@copilot why are the comments not getting addressed by you? |
Removed duplicate DataRows for gov/china/managed instance clouds since they just test string assignment and don't actually validate cloud endpoints. Kept essential test cases: enabled only, audience only, and both together. Test count reduced from 12 to 9 tests while maintaining full coverage. Co-authored-by: anushakolan <45540936+anushakolan@users.noreply.github.com>
Addressed the comment from @Aniruddh25 in commit 098fbcc. Removed redundant DataRows for different cloud audiences since they all test the same string assignment behavior. |
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
Why make this change?
Implements CLI configuration for OBO (On-Behalf-Of) delegated identity as specified in #2898. The OBO core implementation was merged into main via PR #3151. This PR adds CLI commands to enable operators to configure per-user Entra ID authentication to Azure SQL and SQL Server via CLI instead of manual config file editing.
What is this change?
CLI Commands Added
dab configure --data-source.user-delegated-auth.enabled true- Enable/disable OBO authentication for Azure SQL and SQL Serverdab configure --data-source.user-delegated-auth.database-audience "https://database.windows.net"- Configure database resource identifier for token acquisitionImplementation Details
ConfigureOptions.cswith two new CLI option parameters (dataSourceUserDelegatedAuthEnabled,dataSourceUserDelegatedAuthDatabaseAudience)ConfigGenerator.TryUpdateConfiguredDataSourceOptions()to create/updateUserDelegatedAuthOptionsconfigurationConfiguration Output
The CLI generates configuration that integrates with the
UserDelegatedAuthOptionsfrom the merged OBO implementation:{ "data-source": { "database-type": "mssql", "connection-string": "...", "user-delegated-auth": { "enabled": true, "provider": "EntraId", "database-audience": "https://database.windows.net" } } }Files Changed (5 CLI-specific files)
src/Cli/Commands/ConfigureOptions.cs- CLI option definitions with SQL Server on-premises supportsrc/Cli/ConfigGenerator.cs- Configuration update logicsrc/Cli.Tests/ConfigureOptionsTests.cs- Consolidated CLI configuration testssrc/Cli.Tests/UserDelegatedAuthRuntimeParsingTests.cs- 2 runtime parsing testssrc/Cli.Tests/TestHelper.cs- Added CONFIG_WITH_USER_DELEGATED_AUTH test constantHow was this tested?
Sample Request(s)
Initialize and configure OBO in one workflow:
Update audience for existing configuration:
dab configure --data-source.user-delegated-auth.database-audience "https://database.usgovcloudapi.net"Update only the enabled flag:
dab configure --data-source.user-delegated-auth.enabled falseValidation - fails for non-MSSQL:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.