Add-AzureADScopedRoleMembership

Adds a scoped role membership to an administrative unit.

Syntax

Add-AzureADScopedRoleMembership
   -ObjectId <String>
   [-AdministrativeUnitObjectId <String>]
   [-RoleObjectId <String>]
   [-RoleMemberInfo <RoleMemberInfo>]
   [<CommonParameters>]

Description

The Add-AzureADScopedRoleMembership cmdlet adds a scoped role membership to an administrative unit.

Examples

Example 1

$User = Get-AzureADUser -SearchString "The user that will be an admin on this unit"
	$Role = Get-AzureADDirectoryRole | Where-Object -Property DisplayName -EQ -Value "User Account Administrator"
	$Unit = Get-AzureADAdministrativeUnit | Where-Object -Property DisplayName -Eq -Value "<The display name of the unit"
	$RoleMember = New-Object -TypeName Microsoft.Open.AzureAD.Model.RoleMemberInfo
	$RoleMember.ObjectId = $User.ObjectID
	Add-AzureADScopedRoleMembership -ObjectId $unit.ObjectId -RoleObjectId $Role.ObjectId -RoleMemberInfo $RoleMember

This cmdlet returns the Scope role membership object:

AdministrativeUnitObjectId           RoleObjectId
--------------------------           ------------
c9ab56cc-e349-4237-856e-cab03157a91e 526b7173-5a6e-49dc-88ec-b677a9093709

Parameters

-AdministrativeUnitObjectId

Specifies the ID of an administrative unit.

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

-ObjectId

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

-RoleMemberInfo

Specifies a RoleMemberInfo object.

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

-RoleObjectId

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