-
Notifications
You must be signed in to change notification settings - Fork 372
Add support for Federated Identity Credentials in connection methods and parameters #4870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
Hey @reshmee011 , any chance you might be able to test out this auth mode ? Just saw you do some interesting stuff in this area and was wondering if you might be able to help here with the FIC approach, no pressure 😊 |
@gautamdsheth : that's a very cool addition/feature. I will try to spare some time over the weekend to test it. Thanks so much to make the product better. |
Co-authored-by: Copilot <[email protected]>
- Updated PnPConnection to streamline the creation of connections using Federated Identity credentials. - Modified TokenHandler to include methods for acquiring tokens using Federated Identity in GitHub Actions and Azure DevOps. - Adjusted PnPSharePointCmdlet to handle token retrieval for Federated Identity connections. - Changed InitializationType and ConnectionMethod enums to reflect the new Federated Identity terminology. - Removed unnecessary parameters related to user-assigned managed identities.
…ndling and streamline HttpClient instantiation
…rove header management
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for Federated Identity Credentials across connection methods and parameters.
- Introduces a new
FederatedIdentity
enum value and initialization type - Implements federated token exchange for GitHub Actions and Azure DevOps
- Extends
ConnectOnline
,PnPConnection
,TokenHandler
, and documentation to handle the new flow
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/Commands/Model/ConnectionMethod.cs | Added FederatedIdentity enum value |
src/Commands/Enums/InitializationType.cs | Added FederatedIdentity initialization type |
src/Commands/Base/TokenHandler.cs | Implemented GetFederatedIdentityTokenAsync and related helpers |
src/Commands/Base/PnPSharePointCmdlet.cs | Extended access-token properties to handle federated identity |
src/Commands/Base/PnPConnection.cs | Added CreateWithFederatedIdentity and updated CreateWithManagedIdentity |
src/Commands/Base/ConnectOnline.cs | Added parameter set and ConnectFederatedIdentity method |
documentation/Connect-PnPOnline.md | Documented -FederatedIdentity switch and example |
Comments suppressed due to low confidence (3)
src/Commands/Base/TokenHandler.cs:265
- The XML doc comment for
GetFederatedIdentityTokenAsync
is copy-pasted from the workload identity method and does not match this method’s purpose or parameters. Update<summary>
and<param>
tags to reflect federated identity semantics and the actual method signature.
/// Returns an access token based on a Azure AD Workload Identity. Only works within Azure components supporting workload identities.
src/Commands/Base/ConnectOnline.cs:90
- The
Url
parameter is optional in the FederatedIdentity parameter set, but it’s required to form the resource URI. Mark itMandatory = true
to avoid null references when building the token scope.
[Parameter(Mandatory = false, Position = 0, ParameterSetName = ParameterSet_FEDERATEDIDENTITY, ValueFromPipeline = true)]
src/Commands/Base/PnPConnection.cs:408
- Replacing the original
AuthenticationManager
constructor call withCreateWithManagedIdentity(null, null, ...)
drops the endpoint and header fallback logic. This will break MSI token acquisition outside your default environment. Restore or refactor the endpoint/header resolution.
using (var authManager = Framework.AuthenticationManager.CreateWithManagedIdentity(null, null, managedIdentityType, managedIdentityUserAssignedIdentifier))
Before creating a pull request, make sure that you have read the contribution file located at
https://github.com/pnp/powerShell/blob/dev/CONTRIBUTING.md
Type
Related Issues?
Fixes #X, partially fixes #Y, mentioned in #Z, etc.
What is in this Pull Request ?
Please describe the changes in the PR.
Guidance