列出 Microsoft Entra 角色定義

角色定義是可執行的許可權集合,例如讀取、寫入和刪除。 它通常只稱為角色。 Microsoft Entra ID 有超過 60 個內建角色,或者您可以建立自己的自定義角色。 如果您曾經想過「這些角色真的做什麼?」,您可以查看每個角色的詳細許可權清單。

本文說明如何列出 Microsoft Entra 內建和自定義角色及其許可權。

必要條件

  • 使用 PowerShell 時安裝的 Microsoft Graph PowerShell SDK
  • 針對 Microsoft Graph API 使用 Graph 總管時的管理員同意

如需詳細資訊,請參閱 使用PowerShell或 Graph 總管的必要條件。

Microsoft Entra 系統管理中心

提示

本文中的步驟可能會根據您從開始的入口網站稍有不同。

  1. 登入 Microsoft Entra 系統管理中心。

  2. 流覽至 [身分>識別角色] 和 [系統管理員>角色] 和 [系統管理員]。

    list of roles in Azure portal

  3. 在右側,選取省略號,然後 選取 [描述 ] 以查看角色許可權的完整清單。

    此頁面包含相關文件的連結,可協助您完成管理角色。

    Screenshot that shows the

PowerShell

請遵循下列步驟,使用 PowerShell 列出 Microsoft Entra 角色。

  1. 開啟 PowerShell 視窗。 如有必要,請使用 Install-Module 來安裝 Microsoft Graph PowerShell。 如需詳細資訊,請參閱 使用PowerShell或 Graph 總管的必要條件。

    Install-Module Microsoft.Graph -Scope CurrentUser
    
  2. 在 PowerShell 視窗中,使用 連線-MgGraph 登入您的租使用者。

    Connect-MgGraph -Scopes "RoleManagement.Read.All"
    
  3. 使用 Get-MgRoleManagementDirectoryRoleDefinition 取得所有角色。

    Get-MgRoleManagementDirectoryRoleDefinition
    
  4. 若要檢視角色的許可權清單,請使用下列 Cmdlet。

    # Do this avoid truncation of the list of permissions
    $FormatEnumerationLimit = -1
    
    (Get-MgRoleManagementDirectoryRoleDefinition -Filter "displayName eq 'Conditional Access Administrator'").RolePermissions | Format-list
    

Microsoft Graph API

請遵循這些指示,在 Graph 總管中使用 Microsoft Graph API 列出 Microsoft Entra 角色。

  1. 登入 Graph 總管

  2. 從下拉式清單中選取 [GET ] 作為 HTTP 方法。

  3. 選取 V1.0API 版本。

  4. 新增下列查詢以使用 List unifiedRoleDefinitions API。

    GET https://graph.microsoft.com/v1.0/roleManagement/directory/roleDefinitions
    
  5. 選取 [ 執行查詢 ] 以列出角色。

  6. 若要檢視角色的許可權,請使用下列 API。

    GET https://graph.microsoft.com/v1.0/roleManagement/directory/roleDefinitions?$filter=DisplayName eq 'Conditional Access Administrator'&$select=rolePermissions
    

下一步