Rediger

Del via


Add-MsolScopedRoleMember

Adds a member to an administrative unit-scoped role.

Syntax

Add-MsolScopedRoleMember
   -RoleObjectId <Guid>
   -AdministrativeUnitObjectId <Guid>
   [-RoleMemberObjectId <Guid>]
   [-RoleMemberUserPrincipalName <String>]
   [-TenantId <Guid>]
   [<CommonParameters>]

Description

The Add-MsolScopedRoleMember cmdlet adds a member to an administrative unit-scoped role.

Examples

Example 1: Add a member to an administrative unit-scoped role

PS C:\> $WestCoastAu = Get-MsolAdministrativeUnit -SearchString "West Coast"
PS C:\> $UaAdmin = Get-MsolRole -RoleName "User Account Administrator"
PS C:\> $Admin01 = Get-MsolUser -UserPrincipalName "elisadaugherty@contoso.com"
PS C:\> Add-MsolScopedRoleMember -RoleObjectId $UaAdmin.ObjectId -AdministrativeUnitObjectId $WestCoastAu.ObjectId -RoleMemberObjectId $Admin01.ObjectId

This example adds elisadaugherty@contoso.com as a member to the User Account Administrator role scoped for the administrative unit named West Coast.

Parameters

-AdministrativeUnitObjectId

Specifies the unique object ID of the administrative unit.

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

-RoleMemberObjectId

Specifies the unique object ID of the member to add to the role scoped to the administrative unit. For users, specify a user ID. You can add only users to a role.

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

-RoleMemberUserPrincipalName

Specifies the user principal name of the member to add. You can add only users to a role.

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

-RoleObjectId

Specifies the unique object ID of the role to which to add members. You can add only users to a role. Adding a security group is not supported.

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