Remove-AzADGroupMember

Deletes member from group Users, contacts, and groups that are members of this group. HTTP Methods: GET (supported for all groups), POST (supported for security groups and mail-enabled security groups), DELETE (supported only for security groups) Read-only. Nullable. Supports $expand.

Syntax

Remove-AzADGroupMember
      [-DefaultProfile <PSObject>]
      [-PassThru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzADGroupMember
      -GroupObjectId <String>
      -MemberObjectId <String[]>
      [-DefaultProfile <PSObject>]
      [-PassThru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzADGroupMember
      -GroupObjectId <String>
      -MemberUserPrincipalName <String[]>
      [-DefaultProfile <PSObject>]
      [-PassThru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzADGroupMember
      -MemberUserPrincipalName <String[]>
      -GroupObject <MicrosoftGraphGroup>
      [-DefaultProfile <PSObject>]
      [-PassThru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzADGroupMember
      -MemberUserPrincipalName <String[]>
      -GroupDisplayName <String>
      [-DefaultProfile <PSObject>]
      [-PassThru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzADGroupMember
      -MemberObjectId <String[]>
      -GroupObject <MicrosoftGraphGroup>
      [-DefaultProfile <PSObject>]
      [-PassThru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzADGroupMember
      -MemberObjectId <String[]>
      -GroupDisplayName <String>
      [-DefaultProfile <PSObject>]
      [-PassThru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

Deletes member from group Users, contacts, and groups that are members of this group. HTTP Methods: GET (supported for all groups), POST (supported for security groups and mail-enabled security groups), DELETE (supported only for security groups) Read-only. Nullable. Supports $expand.

Examples

Example 1: Remove members from group

$members = @()
$members += (Get-AzADUser -DisplayName $uname).Id
$members += (Get-AzADServicePrincipal -ApplicationId $appid).Id
Get-AzADGroupMember -GroupDisplayName $gname | Remove-AzADGroupMember -MemberObjectId $member

Remove members from group

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:PSObject
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-GroupDisplayName

The display name of target group.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-GroupObject

The target group object, could be used as pipeline input.

Type:MicrosoftGraphGroup
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-GroupObjectId

The object Id of target group.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-MemberObjectId

The object Id of member to be removed from target group.

Type:String[]
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-MemberUserPrincipalName

The user principal name of member to be removed from target group.

Type:String[]
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PassThru

Returns true when the command succeeds

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

MicrosoftGraphGroup

Outputs

Boolean