Add-MsolGroupMember

Updated: July 30, 2015

Applies To: Azure, Office 365, Windows Intune

Note



  • The cmdlets were previously known as the Microsoft Online Services Module for Windows PowerShell cmdlets.

The Add-MsolGroupMember cmdlet is used to add members to a security group. The new members can be either users or other security groups.

Syntax

Add-MsolGroupMember -GroupMemberObjectId <Guid> -GroupObjectId <Guid> [-GroupMemberType <string>] [-TenantId <Guid>] [<CommonParameters>]

Parameters

    -GroupMemberObjectId <Guid>
        The object ID of the member (User or Group) to add to the group.
        
        Required?                    true
        Position?                    named
        Default value                
        Accept pipeline input?       true (ByPropertyName)
        Accept wildcard characters?  false
        
    -GroupMemberType <string>
        The type of member (User or Group) to add to the group.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       true (ByPropertyName)
        Accept wildcard characters?  false
        
    -GroupObjectId <Guid>
        The ID of the group to add members to.
        
        Required?                    true
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -TenantId <Guid>
        The unique ID of the tenant to perform the operation on. If this is 
        not provided then the value will default to the tenant of the current 
        user. This parameter is only applicable to partner users.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       true (ByPropertyName)
        Accept wildcard characters?  false
        
    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        "get-help about_commonparameters".

Examples

The following four commands add the user with the display name Cody Cowles to the Marketing group. The first two commands equate the variables $CCowles and $MktGrp to the display names Cody Cowles and Marketing, respectively. The third command adds the user to the group. The fourth command displays the members of the Marketing group.

$CCowles = Get-MsolGroup | Where-Object {$_.DisplayName -eq "Cody Cowles"}

$MktGrp = Get-MsolGroup | Where-Object {$_.DisplayName -eq "Marketing"}

Add-MsolGroupMember -groupObjectid $MktGrp.ObjectId -GroupMemberType "User" -GroupMemberObjectId $CCowles.ObjectId

Get-MsolGroupMember -GroupObjectId $MktGrp.ObjectId

Additional Resources

There are several other places you can get more information and help. These include:

See Also

Other Resources

Manage Azure Active Directory by using Windows PowerShell