Public/Authentication/Close-SIASession.ps1

function Close-SIASession {
    <#
    .SYNOPSIS
        Ends the active psSIA session.
    .DESCRIPTION
        Discards the in-memory session created by New-SIASession. CyberArk does
        not document a logout endpoint for platform tokens - they simply expire
        after their 900-second lifetime - so this is a local, client-side
        operation only.
    .EXAMPLE
        Close-SIASession

        Discards the current session.
    .INPUTS
        None.
    .OUTPUTS
        None.
    #>

    [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')]
    param()

    if (-not $script:SIASession) {
        return
    }

    if ($PSCmdlet.ShouldProcess("SIA session for $($script:SIASession.Subdomain)", 'Close')) {
        $script:SIASession = $null
    }
}