Get Microsoft 365 Group and Security Group Owner Details & Generate an Audit Report

IMPORTANT:
Cloud Modernization Notice (2026):
The legacy AzureAD PowerShell module has been retired. This article has been updated with production-tested Microsoft Graph PowerShell SDK (Get-MgGroup & Get-MgGroupOwner) commands. The historical AzureAD commands are retained below for archival reference.

Whether you are auditing orphaned Microsoft 365 Groups (Unified Groups), reviewing Teams ownership before license offboarding, or verifying security group ownership in Microsoft Entra ID, generating a clean group owner report is an essential task for cloud administrators.

In this guide, we cover how to query group owners using modern Microsoft Graph PowerShell SDK, create reusable helper functions, and run an automated tenant-wide owner audit script with CSV export.


Modern Method: Microsoft Graph PowerShell SDK

Prerequisites & Connection

To read group definitions and retrieve their registered directory owners, connect to Microsoft Graph with the Group.Read.All and User.Read.All scopes:

POWERSHELL
# Install the Microsoft Graph Groups & Users modules if needed
Install-Module Microsoft.Graph.Groups, Microsoft.Graph.Users -Scope CurrentUser -Repository PSGallery -Force

# Connect to Graph
Connect-MgGraph -Scopes "Group.Read.All", "User.Read.All"

Step 1: Query Group Object ID

Search for the group using either its display name or primary SMTP email address:

POWERSHELL
# Search by display name
Get-MgGroup -Filter "displayName eq 'Sales Team'" -Property "Id", "DisplayName", "Mail", "GroupTypes"

# Or search using primary email address
Get-MgGroup -Filter "mail eq '[email protected]'" -Property "Id", "DisplayName", "Mail", "GroupTypes"

Step 2: Retrieve Group Owners (Get-MgGroupOwner)

In Microsoft Graph, Get-MgGroupOwner returns a list of directory objects (user, servicePrincipal, or device). To expand their human-readable attributes, cast or inspect the output:

POWERSHELL
$groupId = "5e3c1eaf-27d2-4c2a-a5a1-9f282c3c93ea"

# Query all owners for the specified group
$owners = Get-MgGroupOwner -GroupId $groupId

# Display owner details
foreach ($owner in $owners) {
    # Resolve the directory object details
    $user = Get-MgUser -UserId $owner.Id -Property "Id", "DisplayName", "UserPrincipalName", "UserType"
    [PSCustomObject]@{
        OwnerName = $user.DisplayName
        UPN       = $user.UserPrincipalName
        UserType  = $user.UserType
        Id        = $user.Id
    }
}

Step 3: Reusable PowerShell One-Liner / Helper Function

Add this function to your PowerShell profile for instant lookup by group email or name:

POWERSHELL
function Get-M365GroupOwner {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [string]$GroupIdentifier
    )
    
    # Try finding group by email or display name
    $group = Get-MgGroup -Filter "mail eq '$GroupIdentifier' or displayName eq '$GroupIdentifier'" -Property "Id", "DisplayName", "Mail" -Top 1
    if (-not $group) {
        Write-Warning "Group '$GroupIdentifier' not found."
        return
    }
    
    $owners = Get-MgGroupOwner -GroupId $group.Id
    if (-not $owners) {
        Write-Warning "No owners registered for group '$($group.DisplayName)' (Orphaned Group)."
        return
    }
    
    foreach ($owner in $owners) {
        $user = Get-MgUser -UserId $owner.Id -Property "DisplayName", "UserPrincipalName"
        [PSCustomObject]@{
            GroupName          = $group.DisplayName
            GroupEmail         = $group.Mail
            OwnerDisplayName   = $user.DisplayName
            OwnerPrincipalName = $user.UserPrincipalName
        }
    }
}

# Example Usage:
Get-M365GroupOwner -GroupIdentifier "[email protected]"

Production Audit Script: Export All M365 Group Owners to CSV

Here is a tenant-wide audit script that scans all Microsoft 365 Groups (Unified Groups), captures multiple owners per group, flags orphaned groups (0 owners), and exports the findings directly to CSV.

POWERSHELL
<#
.SYNOPSIS
    Generates a tenant-wide Microsoft 365 Group owner audit report via Microsoft Graph.
.DESCRIPTION
    Scans all Unified/M365 groups, expands owners, flags orphaned groups, and exports to CSV.
.NOTES
    Author: Sunil Chauhan (https://www.lab365.in)
#>

[CmdletBinding()]
param(
    [string]$ExportPath = ".\M365_Group_Owners_Report_$(Get-Date -Format 'yyyyMMdd_HHmmss').csv"
)

# Connect to Graph if not already active
if (-not (Get-MgContext)) {
    Connect-MgGraph -Scopes "Group.Read.All", "User.Read.All"
}

Write-Host "Fetching all Microsoft 365 Groups..." -ForegroundColor Cyan
# Filter specifically for Microsoft 365 Groups (Unified Groups)
$allGroups = Get-MgGroup -Filter "groupTypes/any(c:c eq 'Unified')" -Property "Id", "DisplayName", "Mail", "CreatedDateTime" -All

Write-Host "Found $($allGroups.Count) Microsoft 365 Groups. Querying owners..." -ForegroundColor Yellow

$report = [System.Collections.Generic.List[PSCustomObject]]::new()

foreach ($group in $allGroups) {
    Write-Host "  -> Processing: $($group.DisplayName)" -ForegroundColor Gray
    
    $owners = Get-MgGroupOwner -GroupId $group.Id
    
    if (-not $owners -or $owners.Count -eq 0) {
        # Flag orphaned group
        $report.Add([PSCustomObject]@{
            GroupName          = $group.DisplayName
            GroupEmail         = $group.Mail
            GroupId            = $group.Id
            OwnerCount         = 0
            OwnerDisplayName   = "⚠️ NO OWNER (ORPHANED)"
            OwnerPrincipalName = "N/A"
            CreatedDate        = $group.CreatedDateTime
        })
        continue
    }
    
    foreach ($owner in $owners) {
        $ownerUser = Get-MgUser -UserId $owner.Id -Property "DisplayName", "UserPrincipalName" -ErrorAction SilentlyContinue
        
        $report.Add([PSCustomObject]@{
            GroupName          = $group.DisplayName
            GroupEmail         = $group.Mail
            GroupId            = $group.Id
            OwnerCount         = $owners.Count
            OwnerDisplayName   = if ($ownerUser) { $ownerUser.DisplayName } else { "Unknown / App" }
            OwnerPrincipalName = if ($ownerUser) { $ownerUser.UserPrincipalName } else { $owner.Id }
            CreatedDate        = $group.CreatedDateTime
        })
    }
}

$report | Export-Csv -Path $ExportPath -NoTypeInformation -Encoding utf8
Write-Host "[✓] Audit completed! Report saved to: $ExportPath" -ForegroundColor Green

Legacy AzureAD Method (Archival Reference)

Click to view historical instructions using the retired AzureAD module

Connect to AzureAD:

POWERSHELL
Connect-AzureAD

Query group using -SearchString:

POWERSHELL
Get-AzureADGroup -SearchString "[email protected]"

Get owners by ObjectId:

POWERSHELL
Get-AzureADGroupOwner -ObjectId "5e3c1eaf-27d2-4c2a-a5a1-9f282c3c93ea"

Legacy loop report:

POWERSHELL
$Groups = Get-AzureADGroup -All $true | Where-Object { $_.MailEnabled -eq $true }
$report = @()
foreach ($group in $Groups) {
    Write-Host "Processing Group: $($group.DisplayName)"
    $owners = Get-AzureADGroupOwner -ObjectId $group.ObjectId
    $data = $owners | Select-Object @{n="GroupName";E={$group.DisplayName}}, `
        @{n="GroupEmailAddress";E={$group.Mail}}, `
        @{n="OwnerDisplayName";E={$_.DisplayName}}, `
        @{n="OwnerEmailAddress";E={$_.UserPrincipalName}}
    $report += $data
}
$report | Export-Csv "O365Group-Owner-Details.csv" -NoTypeInformation


Need to automatically alert or assign replacement owners to orphaned groups? Check out our article on Microsoft Graph SDK Automation with PowerShell 7.