[#1044] Align Workload identity configuration support to current Connection Configuration Specification#1079
Open
ceciliaavila wants to merge 9 commits intomainfrom
Open
[#1044] Align Workload identity configuration support to current Connection Configuration Specification#1079ceciliaavila wants to merge 9 commits intomainfrom
ceciliaavila wants to merge 9 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates agents-hosting authentication configuration to align with the current Connection Configuration Specification by introducing an explicit authtype and federatedtokenfile for Workload Identity, while also adding a dedicated System Managed Identity token acquisition path.
Changes:
- Added
AuthTypeenum and expandedAuthConfigurationwithauthtype+federatedtokenfile(withWIDAssertionFilemarked deprecated). - Refactored
MsalTokenProvider(and connection logging) to preferauthtypeand support Workload Identity + SystemManagedIdentity explicitly, with new structured errors. - Added/updated tests to cover Workload Identity acquisition via the new
authtype+federatedtokenfilesettings.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/agents-hosting/src/auth/authConfiguration.ts | Introduces AuthType, adds authtype and federatedtokenfile, and loads them from env/config. |
| packages/agents-hosting/src/auth/msalTokenProvider.ts | Switches token acquisition to be driven by authtype, adds System Managed Identity path, and integrates new validation errors. |
| packages/agents-hosting/src/auth/msalConnectionManager.ts | Updates connection logging to prefer authtype and new AuthType values. |
| packages/agents-hosting/src/errorHelper.ts | Adds new error definitions for unsupported auth types and missing required config for specific auth modes. |
| packages/agents-hosting/test/hosting/msalTokenProvider.test.ts | Adds WID test coverage for authtype=WorkloadIdentity + federatedtokenfile and adjusts WID test stubbing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Fixes #1044
Fixes #1075
Description
This pull request enhances the authentication configuration system for agent connections by introducing a new
authtypeproperty and supporting federated token files for Workload Identity. It standardizes and expands the supported authentication types, updates the logic for acquiring tokens, and improves test coverage for the new configuration options.Additionally, it fixes an issue with
SystemManagedIdentitythat was failing when acquiring the access token.Detailed Change
Authentication configuration and type support:
AuthTypeenum to define supported authentication types (e.g.,Certificate,ClientSecret,WorkloadIdentity, etc.), and extended theAuthConfigurationinterface with new properties:authtypeandfederatedtokenfile. TheWIDAssertionFileproperty is now marked as deprecated in favor of these new options. [1] [2]Configuration loading and environment variable support:
loadPrevAuthConfigFromEnvandbuildLegacyAuthConfigto read the newauthtypeandfederatedtokenfilefrom environment variables, ensuring backward compatibility and easier configuration. [1] [2]Token acquisition logic:
MsalTokenProviderto use the newauthtypeproperty, supporting all defined authentication types through a switch statement. The logic now prioritizesauthtypeand falls back to legacy properties if not set. Federated token file support is integrated into Workload Identity flows. [1] [2] [3] [4]Connection management:
MsalConnectionManagerto use the newauthtypeproperty for determining the authentication method, improving clarity in connection logging and management.Testing:
authtypeset toWorkloadIdentityand the newfederatedtokenfileproperty, ensuring correct behavior for the updated configuration. [1] [2]Testing
These images show a sample running and authenticating via WID successfully.

These images show the SystemManagedIdentity token retrieval working.
