Skip to content

Conversation

@gautamdsheth
Copy link
Collaborator

Type

  • Bug Fix
  • New Feature
  • Sample

Related Issues?

Fixes #5099

What is in this Pull Request ?

Added support to remove users by Object ID

…ve-PnPAzureADGroupOwner cmdlets; update documentation and utility methods for handling directory objects
Copilot AI review requested due to automatic review settings November 16, 2025 19:39
Copilot finished reviewing on behalf of gautamdsheth November 16, 2025 19:41
Copy link
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

This PR adds support for removing Azure AD group members and owners by Object ID, addressing the limitation where only UPN-based removal was possible. This enables removal of directory objects that don't have a UPN, such as nested groups.

Key Changes:

  • Added MemberObjectId parameter to both cmdlets with a new parameter set "ByObjectId"
  • Added two new utility methods to handle Object ID-based removal operations
  • Updated documentation with new syntax and examples for the ObjectId parameter

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/Commands/Utilities/Microsoft365GroupsUtility.cs Added RemoveDirectoryMembers and RemoveDirectoryOwners utility methods to handle removal by Object ID
src/Commands/AzureAD/RemoveAzureADGroupOwner.cs Added parameter set support and MemberObjectId parameter for removing owners by Object ID
src/Commands/AzureAD/RemoveAzureADGroupMember.cs Added parameter set support and MemberObjectId parameter for removing members by Object ID
documentation/Remove-PnPAzureADGroupOwner.md Added syntax, examples, and parameter documentation for the new MemberObjectId parameter
documentation/Remove-PnPAzureADGroupMember.md Added syntax, examples, and parameter documentation for the new MemberObjectId parameter

## SYNTAX

```powershell
Remove-PnPAzureADGroupOwner -Identity <AzureADGroupPipeBind> -Users <String[]> [-Verbose]
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The syntax section should include parameter set names to clarify which parameters belong to which set. Consider adding '### ByUPN' and '### ByObjectId' headings above each syntax example, similar to standard PowerShell documentation format.

Copilot uses AI. Check for mistakes.

```powershell
Remove-PnPAzureADGroupMember -Identity <AzureADGroupPipeBind> -Users <String[]>
Remove-PnPAzureADGroupMember -Identity <AzureADGroupPipeBind> -Users <String[]>
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The syntax section should include parameter set names to clarify which parameters belong to which set. Consider adding '### ByUPN' and '### ByObjectId' headings above each syntax example, similar to standard PowerShell documentation format.

Copilot uses AI. Check for mistakes.
gautamdsheth and others added 2 commits November 16, 2025 21:46
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@gautamdsheth gautamdsheth merged commit 989e806 into dev Nov 16, 2025
5 checks passed
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.

[FEATURE] Remove-PnPAzureADGroupMember should be able to remove Groups

2 participants