Rediger

Del via


Add-AzureADMSScopedRoleMembership

Adds a scoped role membership to an administrative unit.

Syntax

Add-AzureADMSScopedRoleMembership
   -Id <String>
   [-AdministrativeUnitId <String>]
   [-RoleId <String>]
   [-RoleMemberInfo <MsRoleMemberInfo>]
   [<CommonParameters>]

Description

The Add-AzureADMSScopedRoleMembership 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 Administrator"
	$Unit = Get-AzureADMSAdministrativeUnit | Where-Object -Property DisplayName -Eq -Value "<The display name of the unit>"
	$RoleMember = New-Object -TypeName Microsoft.Open.MSGraph.Model.MsRolememberinfo
	$RoleMember.Id = $User.ObjectID
	Add-AzureADMSScopedRoleMembership -Id $Unit.Id -RoleId $Role.ObjectId -RoleMemberInfo $RoleMember

This cmdlet returns the Scope role membership object:

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

Parameters

-AdministrativeUnitId

Specifies the ID of an administrative unit.

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

-Id

@{Text=}

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

-RoleId

{{ Fill RoleId Description }}

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

-RoleMemberInfo

Specifies a RoleMemberInfo object.

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