Skip to content

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

Open
wants to merge 14 commits into
base: dev
Choose a base branch
from

Conversation

gautamdsheth
Copy link
Collaborator

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

  • Bug Fix
  • New Feature
  • Sample

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

  • You can delete this section when you are submitting the pull request.*
  • Please update this PR information accordingly. We use this as part of our release notes in monthly communications.
  • Please target your PR to Dev branch. If you do not target the Dev branch we will not accept this PR.

@gautamdsheth
Copy link
Collaborator Author

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 😊
Appreciate any help in this.

@reshmee011
Copy link
Contributor

@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.

@gautamdsheth gautamdsheth requested a review from Copilot May 3, 2025 18:23
Copilot

This comment was marked as outdated.

gautamdsheth and others added 8 commits May 3, 2025 21:26
- 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.
@gautamdsheth gautamdsheth requested a review from Copilot June 7, 2025 09:07
Copilot

This comment was marked as outdated.

@gautamdsheth gautamdsheth requested a review from Copilot June 7, 2025 09:29
Copilot

This comment was marked as outdated.

@gautamdsheth gautamdsheth requested a review from Copilot June 7, 2025 09:47
Copilot

This comment was marked as outdated.

…ndling and streamline HttpClient instantiation
@gautamdsheth gautamdsheth requested a review from Copilot June 7, 2025 09:55
Copilot

This comment was marked as outdated.

@gautamdsheth gautamdsheth requested a review from Copilot June 7, 2025 10:20
Copy link

@Copilot Copilot AI left a 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 it Mandatory = 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 with CreateWithManagedIdentity(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))

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