AZ_ADD_MEMBERS
Summary
Description
Identification
PowerShell
# Requires: Install-Module Microsoft.Graph -Scope CurrentUser
# Connect-MgGraph -Scopes "Directory.Read.All","Group.Read.All","RoleManagement.Read.Directory"
# Get users in privileged roles that can add group members
$roles = @('Global Administrator','Privileged Role Administrator','Groups Administrator','User Administrator')
$roleMembers = Get-MgDirectoryRole -All | Where-Object { $_.DisplayName -in $roles } | ForEach-Object {
$role = $_.DisplayName
Get-MgDirectoryRoleMember -DirectoryRoleId $_.Id -All | ForEach-Object {
[pscustomobject]@{ Role = $role; Member = $_.AdditionalProperties['displayName']; Id = $_.Id }
}
}
# Get all group owners
$groupOwners = Get-MgGroup -All | ForEach-Object {
$g = $_
Get-MgGroupOwner -GroupId $g.Id -All -ErrorAction SilentlyContinue | ForEach-Object {
[pscustomobject]@{
Group = $g.DisplayName
Owner = $_.AdditionalProperties['displayName']
Type = ($_.AdditionalProperties['@odata.type'] -replace '#microsoft.graph.','')
}
}
}
"=== PRIVILEGED ROLE MEMBERS ==="
$roleMembers | Format-Table -AutoSize
"=== GROUP OWNERS ==="
$groupOwners | Sort-Object Group | Format-Table -AutoSizeAzure CLI
Azure GUI

image.png 
image.png 
image.png
Exploitation
PowerShell

Azure GUI
Mitigation
Detection

References
Last updated
Was this helpful?