Skip to content

Get-MgmtGraphGroupPermissionGrant

MgmtGraph: Retrieves group permission grants

#Requires -Version 5.1
#Requires -Modules Microsoft.Graph.Groups

[CmdletBinding()]
Param (
    [Parameter(Mandatory = $true, Position = 0)]
    [string]$GroupId
)

Process {
    try {
        $grants = Get-MgGroupPermissionGrant -GroupId $GroupId -All -ErrorAction Stop
        
        $results = foreach ($g in $grants) {
            [PSCustomObject]@{
                GroupId       = $GroupId
                GrantId       = $g.Id
                Permission    = $g.Permission
                PrincipalId   = $g.PrincipalId
                ClientAppId   = $g.ClientId
                Timestamp     = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
            }
        }

        Write-Output $results
    }
    catch {
        throw
    }
}

The unique identifier of the Microsoft Graph group.

An interactive directory of PowerShell scripts.