创建或删除管理单元

重要

受限管理单元目前以预览版提供。 有关 beta 版本、预览版或尚未正式发布的版本的 Azure 功能所适用的法律条款,请参阅产品条款

使用管理单元,可以将你的组织细分为任何想要的单元,然后分配只能对该单元的成员进行管理的特定管理员。 例如,可以使用管理单元将权限委派给一所大型大学的每个学院的管理员,以便他们可以控制访问权限、管理用户以及仅在工程学院中设置策略。

本文介绍如何在 Microsoft Entra ID 中创建或删除管理单元以限制角色权限的范围。

先决条件

  • 每个管理单元管理员都具有 Microsoft Entra ID P1 或 P2 许可证
  • 管理单元成员具有 Microsoft Entra ID 免费许可证
  • 特权角色管理员角色
  • 使用 Microsoft Graph PowerShell 时需要 Microsoft.Graph 模块
  • 使用 PowerShell 时的 Azure AD PowerShell 模块
  • 使用 PowerShell 和受限管理单元时的 AzureADPreview 模块

有关详细信息,请参阅使用 PowerShell 的先决条件

创建一个管理单元

可以使用 Microsoft Entra 管理中心、PowerShell 或 Microsoft Graph 创建新的管理单元。

Microsoft Entra 管理中心

提示

本文中的步骤可能因开始使用的门户而略有不同。

  1. 至少以特权角色管理员身份登录到 Microsoft Entra 管理中心

  2. 浏览到“标识”>“角色和管理员”>“管理单元”。

    Screenshot of the Administrative units page.

  3. 选择 添加

  4. 在“名称”框中,输入管理单元的名称。 (可选)添加管理单元的说明。

  5. 如果不希望租户级管理员能够访问此管理单元,则将“受限管理单元”切换为“”。 有关详细信息,请参阅受限管理单元

    Screenshot showing the Add administrative unit page and the Name box for entering the name of the administrative unit.

  6. (可选)在“分配角色”选项卡上选择一个角色,然后选择要在此管理单元范围内分配该角色的用户。

    Screenshot showing the Add assignments pane to add role assignments with this administrative unit scope.

  7. 在“查看 + 创建”选项卡上,查看管理单元和所有角色分配。

  8. 选择“创建”按钮。

PowerShell

使用 Connect-MgGraph 命令可登录到租户,并同意所需权限。

Connect-MgGraph -Environment China -Scopes "AdministrativeUnit.ReadWrite.All"

使用 New-MgDirectoryAdministrativeUnit 命令创建新的管理单元。

$params = @{
    DisplayName = "Seattle District Technical Schools"
    Description = "Seattle district technical schools administration"
    Visibility = "HiddenMembership"
}
$adminUnitObj = New-MgDirectoryAdministrativeUnit -BodyParameter $params

使用 New-MgBetaDirectoryAdministrativeUnit 命令创建新的受限管理单元。 将 IsMemberManagementRestricted 属性设置为 $true

$params = @{
    DisplayName = "Contoso Executive Division"
    Description = "Contoso Executive Division administration"
    Visibility = "HiddenMembership"
    IsMemberManagementRestricted = $true
}
$restrictedAU = New-MgBetaDirectoryAdministrativeUnit -BodyParameter $params

Microsoft Graph API

使用 Create administrativeUnit API 创建新的管理单元。

请求

POST https://microsoftgraph.chinacloudapi.cn/v1.0/directory/administrativeUnits

正文

{
  "displayName": "China North Operations",
  "description": "China North Operations administration"
}

使用创建 administrativeUnit(beta 版)API 可创建新的受限管理单元。 将 isMemberManagementRestricted 属性设置为 true

请求

POST https://microsoftgraph.chinacloudapi.cn/beta/administrativeUnits

正文

{ 
  "displayName": "Contoso Executive Division",
  "description": "This administrative unit contains executive accounts of Contoso Corp.", 
  "isMemberManagementRestricted": true
}

删除一个管理单元

在 Microsoft Entra ID 中,可以删除不再需要作为管理角色范围单元的管理单元。 删除管理单元之前,应删除具有该管理单元范围的所有角色分配。

Microsoft Entra 管理中心

  1. 至少以特权角色管理员身份登录到 Microsoft Entra 管理中心

  2. 浏览到“标识”>“角色和管理员”>“管理单元”。

  3. 选择要删除的管理单元。

  4. 选择“角色和管理员”,然后打开角色以查看角色分配。

  5. 删除具有该管理单元范围的所有角色分配。

  6. 浏览到“标识”>“角色和管理员”>“管理单元”。

  7. 勾选要删除的管理单元。

  8. 选择“删除”。

    Screenshot of the administrative unit Delete button and confirmation window.

  9. 若要确认是否要删除管理单元,请选择“是”。

PowerShell

使用 Remove-MgDirectoryAdministrativeUnit 命令可删除管理单元。

$adminUnitObj = Get-MgDirectoryAdministrativeUnit -Filter "DisplayName eq 'Seattle District Technical Schools'"
Remove-MgDirectoryAdministrativeUnit -AdministrativeUnitId $adminUnitObj.Id

Microsoft Graph API

使用 Delete administrativeUnit API 删除管理单元。

DELETE https://microsoftgraph.chinacloudapi.cn/v1.0/directory/administrativeUnits/{admin-unit-id}

后续步骤