Export (0) Print
Expand All
Expand Minimize

Add-MsolGroupMember

Published: March 22, 2013

Updated: September 17, 2014

Applies To: Azure, Office 365, Windows Intune

noteNote
  • This topic provides online help content for cloud services, such as Windows Intune and Office 365, which rely on Microsoft Azure Active Directory for identity and directory services.

  • The Microsoft Azure Active Directory Module for Windows PowerShell 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.

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

    -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".

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

See Also

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft