Public/Policies/Set-IDAuthenticationPolicy.ps1

function Set-IDAuthenticationPolicy {

    [CmdletBinding(SupportsShouldProcess)]
    param
    (
        [Parameter(Mandatory = $true,
            ValueFromPipelinebyPropertyName = $true)]
        $PolicyName,

        [Parameter(Mandatory = $false)]
        $Description = ''
    )

    begin {} #begin

    process {

        $Plinks = Get-IDAuthenticationPolicyLink

        $PolicyBlock = Get-IDAuthenticationPolicyBlock -Name $PolicyName
        $RevStamp = $PolicyBlock | Select-Object -ExpandProperty RevStamp
        $Version = $PolicyBlock | Select-Object -ExpandProperty Version
        $Version++

        if ($PSCmdlet.ShouldProcess($PolicyName, 'Update Authentication Policy')) {

            $Plinks = (ConvertTo-Json -InputObject $Plinks)

            $Body = "{

                'plinks' : $($Plinks),
                'policy': {

                    'Newpolicy': 'false',
                    'Version': '$($Version)',
                    'Path': '/Policy/$PolicyName',
                    'RevStamp': '$($Revstamp)',
                    'Settings': {
                        '/Core/Security/CDS/ExternalMFA/ShowQRCode': true
                    },
                    'Description': '$($Description)'

                }
            }"


            #Constructed parameters for the rest call
            $RestCall = @{

                'URI'         = "https://$($ISPSSSession.TenantId).id.cyberark.cloud/Policy/SavePolicyBlock3"
                'Headers'     = $($ISPSSSession.WebSession.Headers)
                'Method'      = 'Post'
                'Body'        = $Body
                'ContentType' = 'application/json'

            }
            # invoking the rest call
            $result = Invoke-IDRestMethod @RestCall

            return $result

        }
    } #process

    end {} #end
}