Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Add-AzADGroupMember
- Module:
- Az.Resources Module
Adds member to group.
Syntax
MemberObjectIdWithGroupObjectIdParameterSet (Default)
Add-AzADGroupMember
-TargetGroupObjectId <String>
-MemberObjectId <String[]>
[-DefaultProfile <PSObject>]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
MemberUPNWithGroupObjectIdParameterSet
Add-AzADGroupMember
-TargetGroupObjectId <String>
-MemberUserPrincipalName <String[]>
[-DefaultProfile <PSObject>]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
MemberObjectIdWithGroupObjectParameterSet
Add-AzADGroupMember
-MemberObjectId <String[]>
-TargetGroupObject <MicrosoftGraphGroup>
[-DefaultProfile <PSObject>]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
MemberObjectIdWithGroupDisplayNameParameterSet
Add-AzADGroupMember
-MemberObjectId <String[]>
-TargetGroupDisplayName <String>
[-DefaultProfile <PSObject>]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
MemberUPNWithGroupObjectParameterSet
Add-AzADGroupMember
-MemberUserPrincipalName <String[]>
-TargetGroupObject <MicrosoftGraphGroup>
[-DefaultProfile <PSObject>]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
MemberUPNWithGroupDisplayNameParameterSet
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.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | cf |
Parameter sets
-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
-MemberObjectId
The object Id of member to add to target group.
Parameter properties
| Type: | String[] |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-MemberUserPrincipalName
The user principal name of member to add to target group.
Parameter properties
| Type: | String[] |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-PassThru
Returns true when the command succeeds
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-TargetGroupDisplayName
The display name of target group.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-TargetGroupObject
The target group object, could be used as pipeline input.
Parameter properties
| Type: | MicrosoftGraphGroup |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-TargetGroupObjectId
The object Id of target group.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-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
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
Azure PowerShell
Feedback
Was this page helpful?
