Private/Get-NSPConditionalAccessDefinitionReference.ps1
|
function Get-NSPConditionalAccessDefinitionReference { <# .SYNOPSIS Lists the {Kind:Name} references a definition uses, without resolving them. #> [CmdletBinding()] param( [Parameter(Mandatory)][System.Collections.IDictionary]$Definition ) $schema = Get-NSPConditionalAccessDefinitionSchema $seen = @{} foreach ($spec in $schema.Lists) { if ($spec.Contains('Values')) { continue } $container = if ($spec.Section) { $Definition[$spec.Section] } else { $Definition } if ($container -isnot [System.Collections.IDictionary] -or -not $container.Contains($spec.Key)) { continue } foreach ($item in @($container[$spec.Key] | Where-Object { $_ })) { if ($item -cmatch $schema.ReferencePattern) { $key = "$($Matches['kind']):$($Matches['name'])" if (-not $seen.ContainsKey($key)) { $seen[$key] = $true [pscustomobject]@{ Kind = $Matches['kind']; Name = $Matches['name'] } } } } } $strength = if ($Definition['Grant'] -is [System.Collections.IDictionary]) { $Definition['Grant']['AuthenticationStrength'] } else { $null } if ($strength -and $strength -cmatch $schema.ReferencePattern) { [pscustomobject]@{ Kind = $Matches['kind']; Name = $Matches['name'] } } } |