Edit

Share via


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

ExplicitParameterSet (Default)

Remove-AzADGroupMember
    [-DefaultProfile <PSObject>]
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

MemberObjectIdWithGroupObjectId

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

MemberUPNWithGroupObjectIdParameterSet

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

MemberUPNWithGroupObjectParameterSet

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

MemberUPNWithGroupDisplayNameParameterSet

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

MemberObjectIdWithGroupObject

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

MemberObjectIdWithGroupDisplayName

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.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

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

Parameter properties

Type:PSObject
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-GroupDisplayName

The display name of target group.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

MemberUPNWithGroupDisplayNameParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
MemberObjectIdWithGroupDisplayName
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-GroupObject

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

Parameter properties

Type:MicrosoftGraphGroup
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

MemberUPNWithGroupObjectParameterSet
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False
MemberObjectIdWithGroupObject
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-GroupObjectId

The object Id of target group.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

MemberObjectIdWithGroupObjectId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
MemberUPNWithGroupObjectIdParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MemberObjectId

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

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

MemberObjectIdWithGroupObjectId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
MemberObjectIdWithGroupObject
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
MemberObjectIdWithGroupDisplayName
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MemberUserPrincipalName

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

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

MemberUPNWithGroupObjectIdParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
MemberUPNWithGroupObjectParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
MemberUPNWithGroupDisplayNameParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PassThru

Returns true when the command succeeds

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

MicrosoftGraphGroup

Outputs

Boolean