Add-MsolGroupMember

Adds a member to an existing security group.

Syntax

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

Description

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

Examples

Example 1: Add a user to a security group

PS C:\> Add-MsolGroupMember -GroupObjectId 62f684d7-9ab1-4abc-a543-2257e085bdc6 -GroupMemberType User -GroupMemberObjectId bbb55777-d5aa-499d-abbf-353d4523049f

This command adds a user to a security group.

Parameters

-GroupMemberObjectId

Specifies the unique object ID of the user or group to add to the group.

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

-GroupMemberType

Specifies the type of member to add to the group. Valid values are: User and Group.

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

-GroupObjectId

Specifies the unique ID of the group to which to add members.

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

-TenantId

Specifies the unique ID of the tenant on which to perform the operation. The default value is the tenant of the current user. This parameter applies only to partner users.

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