Private/Read-NSPEntraHardMatchUser.ps1

function Read-NSPEntraHardMatchUser {
    <#
    .SYNOPSIS
        Reads one cloud user by object ID, or $null if it no longer exists.
    #>

    [CmdletBinding()]
    param([Parameter(Mandatory)][string]$CloudObjectId)

    $select = 'id,userPrincipalName,userType,onPremisesImmutableId,onPremisesSyncEnabled'
    try { Invoke-NSPGraphRequest -Uri "users/$([uri]::EscapeDataString($CloudObjectId))?`$select=$select" }
    catch {
        if ("$_" -match 'Request_ResourceNotFound|ResourceNotFound|NotFound|404') { return $null }
        throw
    }
}