Group Management: Benutzer-Tab mit Gruppen-Mitgliedschaften

Neuer Tab "Benutzer" im Group Management: Benutzer suchen und alle
Gruppen anzeigen, in denen dieser Mitglied ist (transitiveMemberOf).
Gruppen filterbar, mit Typ-Badge (Sicherheitsgruppe/M365/Verteiler).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-08-12 10:03:49 +02:00
co-authored by Claude Sonnet 4.6
parent 2f0af6e577
commit ec130031cb
4 changed files with 179 additions and 1 deletions
+30
View File
@@ -66,6 +66,10 @@ function Invoke-ApiHandler {
return Remove-GroupMemberEndpoint -GroupId $matches[1] -UserId $matches[2]
}
if ($Method -eq "GET" -and $Path -match "^/api/users/([^/]+)/memberof$") {
return Get-UserMemberOfEndpoint -UserId $matches[1]
}
if ($Method -eq "GET" -and $Path -match "^/api/apps/([^/]+)/details$") {
return Get-AppDetailsEndpoint -AppId $matches[1]
}
@@ -1490,6 +1494,32 @@ function Search-UsersEndpoint {
return @{ items = $items; count = $items.Count }
}
function Get-UserMemberOfEndpoint {
param($UserId)
$err = Test-Connected
if ($err) { return $err }
$groups = @()
$uri = "https://graph.microsoft.com/v1.0/users/$UserId/transitiveMemberOf/microsoft.graph.group?`$select=id,displayName,description,groupTypes,mailEnabled,securityEnabled&`$top=100"
while ($uri) {
$resp = Invoke-MgGraphRequestRetry -Uri $uri -Method GET
foreach ($g in $resp.value) {
$type = 'Sicherheitsgruppe'
if ($g.groupTypes -contains 'Unified') { $type = 'Microsoft 365' }
elseif ($g.mailEnabled -and -not $g.securityEnabled) { $type = 'Verteiler' }
$groups += [pscustomobject]@{
Id = $g.id
DisplayName = $g.displayName
Description = $g.description
Type = $type
}
}
$uri = $resp.'@odata.nextLink'
}
$groups = $groups | Sort-Object DisplayName
return @{ groups = $groups; count = $groups.Count }
}
# ============================================================
# Apps
# ============================================================