編集

次の方法で共有


Add-AzADGroupMember

Adds member to group.

Syntax

Add-AzADGroupMember
   -TargetGroupObjectId <String>
   -MemberObjectId <String[]>
   [-DefaultProfile <PSObject>]
   [-PassThru]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzADGroupMember
   -TargetGroupObjectId <String>
   -MemberUserPrincipalName <String[]>
   [-DefaultProfile <PSObject>]
   [-PassThru]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzADGroupMember
   -MemberObjectId <String[]>
   -TargetGroupObject <MicrosoftGraphGroup>
   [-DefaultProfile <PSObject>]
   [-PassThru]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzADGroupMember
   -MemberObjectId <String[]>
   -TargetGroupDisplayName <String>
   [-DefaultProfile <PSObject>]
   [-PassThru]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzADGroupMember
   -MemberUserPrincipalName <String[]>
   -TargetGroupObject <MicrosoftGraphGroup>
   [-DefaultProfile <PSObject>]
   [-PassThru]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzADGroupMember
   -MemberUserPrincipalName <String[]>
   -TargetGroupDisplayName <String>
   [-DefaultProfile <PSObject>]
   [-PassThru]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Adds member to group.

Examples

Example 1: Add members to group

$groupid=(Get-AzADGroup -DisplayName $gname).Id
$members=@()
$members+=(Get-AzADUser -DisplayName $uname).Id
$members+=(Get-AzADServicePrincipal -ApplicationId $appid).Id
Add-AzADGroupMember -TargetGroupObjectId $groupid -MemberObjectId $members

Add members to 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

-MemberObjectId

The object Id of member to add to 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 add to 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

-TargetGroupDisplayName

The display name of target group.

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

-TargetGroupObject

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

-TargetGroupObjectId

The object Id of target group.

Type:String
Position:Named
Default value:None
Required:True
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