Public/Get-NSPConditionalAccessDefinition.ps1

function Get-NSPConditionalAccessDefinition {
    <#
    .SYNOPSIS
        Loads Conditional Access policy definitions from .psd1 data files.
    .DESCRIPTION
        Definitions are read with Import-PowerShellDataFile, which evaluates data only and never runs code.
        Each returned hashtable gains a SourcePath key. By default the module's own Policies folder is read.
        Loading does not validate. Pipe the result to Test-NSPConditionalAccessDefinition.
    .EXAMPLE
        Get-NSPConditionalAccessDefinition | Test-NSPConditionalAccessDefinition
    .EXAMPLE
        Get-NSPConditionalAccessDefinition -Id 'NSP-BASE-MFA-01'
    #>

    [CmdletBinding()]
    [OutputType([hashtable])]
    param(
        [string]$Path = (Join-Path $script:ModuleRoot 'Policies'),
        [string[]]$Id
    )

    if (-not (Test-Path -LiteralPath $Path)) {
        throw "Policy definition folder not found: $Path"
    }
    foreach ($file in Get-ChildItem -LiteralPath $Path -Filter '*.psd1' -File -Recurse | Sort-Object Name) {
        $definition = Import-PowerShellDataFile -LiteralPath $file.FullName
        if ($Id -and $definition['Id'] -notin $Id) { continue }
        $definition['SourcePath'] = $file.FullName
        $definition
    }
}