Private/Get-SPMClaimClassification.ps1
|
function Get-SPMClaimClassification { <# .SYNOPSIS Classifies a SharePoint claim login name (Entra group, M365 group, Everyone claims, ...). #> [CmdletBinding()] param( [Parameter(Mandatory)] [string]$LoginName ) if ($LoginName -match '^c:0t\.c\|tenant\|(?<id>[0-9a-fA-F\-]{36})$') { return @{ Type = 'EntraGroup'; GroupId = $Matches['id'] } } if ($LoginName -match '^c:0o\.c\|federateddirectoryclaimprovider\|(?<id>[0-9a-fA-F\-]{36})(_o)?$') { return @{ Type = 'M365Group'; GroupId = $Matches['id'] } } if ($LoginName -like 'c:0-.f|rolemanager|spo-grid-all-users*') { return @{ Type = 'EveryoneExceptExternal'; GroupId = $null } } if ($LoginName -eq 'c:0(.s|true') { return @{ Type = 'Everyone'; GroupId = $null } } return @{ Type = 'SecurityGroup'; GroupId = $null } } |