Add-AzureADScopedRoleMembership
將限定範圍的角色成員資格新增至系統管理單位。
語法
Add-AzureADScopedRoleMembership
-ObjectId <String>
[-AdministrativeUnitObjectId <String>]
[-RoleObjectId <String>]
[-RoleMemberInfo <RoleMemberInfo>]
[<CommonParameters>]
Description
Add-AzureADScopedRoleMembership Cmdlet 會將範圍角色成員資格新增至管理單位。
範例
範例 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
此 Cmdlet 會傳回 Scope 角色成員資格物件:
AdministrativeUnitObjectId RoleObjectId
-------------------------- ------------
c9ab56cc-e349-4237-856e-cab03157a91e 526b7173-5a6e-49dc-88ec-b677a9093709
參數
-AdministrativeUnitObjectId
指定系統管理單位的識別碼。
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-ObjectId
類型: | String |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |
-RoleMemberInfo
指定 RoleMemberInfo 物件。
類型: | RoleMemberInfo |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-RoleObjectId
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |