Public/Remove-NSPConditionalAccessTravel.ps1

function Remove-NSPConditionalAccessTravel {
    <#
    .SYNOPSIS
        Requests retirement of a travel entry (a country allowance, or a trip before its end date).
    .DESCRIPTION
        Offline; only marks the entry RetireRequested in the tenant profile. Nothing is deleted
        here. The next deployment plan retires it in the safe order: NSP-BASE-GEO-01 stops
        excluding the group first (restoring the country restriction), and only after that has
        run does a re-plan offer deleting the travel policy and removing the entry.
    .EXAMPLE
        Remove-NSPConditionalAccessTravel -TenantProfile $profilePath -Key 'TRIP-03'
    #>

    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter(Mandatory)][string]$TenantProfile,
        [Parameter(Mandatory)][string]$Key
    )

    $content = Get-Content -LiteralPath $TenantProfile -Raw | ConvertFrom-Json
    $entry = if ($content.Travel -and $content.Travel.Entries) { $content.Travel.Entries.PSObject.Properties[$Key] } else { $null }
    if (-not $entry) { throw "The tenant profile has no travel entry '$Key'." }
    $entry.Value | Add-Member -NotePropertyName RetireRequested -NotePropertyValue $true -Force
    if ($PSCmdlet.ShouldProcess($TenantProfile, "Request retirement of travel entry $Key")) {
        Save-NSPConditionalAccessJson -InputObject $content -Path $TenantProfile
    }
    Get-NSPConditionalAccessTravelEntry -TenantProfile $content | Where-Object Key -eq $Key
}