Skip to content

Enhance Azure AD Workload Identity support by validating environment variables and improving error handling for token file access#5286

Merged
gautamdsheth merged 2 commits into
devfrom
fix/5277
Apr 13, 2026
Merged

Enhance Azure AD Workload Identity support by validating environment variables and improving error handling for token file access#5286
gautamdsheth merged 2 commits into
devfrom
fix/5277

Conversation

@gautamdsheth
Copy link
Copy Markdown
Collaborator

Type

  • Bug Fix
  • New Feature
  • Sample

Related Issues?

Fixes #5277

What is in this Pull Request ?

Improved some error handling

…variables and improving error handling for token file access
Copilot AI review requested due to automatic review settings April 13, 2026 18:36
Copy link
Copy Markdown
Contributor

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

Fixes Connect-PnPOnline -AzureADWorkloadIdentity failures in non-Azure workload identity environments (e.g., GitHub Actions) by validating required environment variables up-front and improving token file error handling, plus clarifying documentation to guide users to the correct auth switch.

Changes:

  • Validate required AZURE_* environment variables for Azure AD Workload Identity and throw clearer PSInvalidOperationException messages when missing.
  • Add explicit token file existence check and wrap token file read errors with a more actionable message.
  • Update Connect-PnPOnline docs to clarify when to use -AzureADWorkloadIdentity vs -FederatedIdentity.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Commands/Base/TokenHandler.cs Adds env var validation and improved token file access error handling for Azure AD Workload Identity token acquisition.
documentation/Connect-PnPOnline.md Clarifies recommended switch usage and required environment variables for workload identity vs federated identity scenarios.

Comment thread src/Commands/Base/TokenHandler.cs Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@gautamdsheth gautamdsheth merged commit 026282b into dev Apr 13, 2026
5 checks passed
@gautamdsheth gautamdsheth deleted the fix/5277 branch April 22, 2026 18:33
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.

[BUG] Connect-PnPOnline -Url $Url -AzureADWorkloadIdentity return error "Value cannot be null. (Parameter 'path')" running under GitHub actions

2 participants