Public/Test-SCAPolicy.ps1

# .ExternalHelp IdentityCommand.SCA-help.xml
function Test-SCAPolicy {
    [CmdletBinding(SupportsShouldProcess)]
    param(
        [parameter(
            Mandatory = $true,
            ValueFromPipelinebyPropertyName = $true
        )]
        [Alias('policy_id')]
        [String]$policyId
    )

    begin { }#begin

    process {

        $URI = Add-QueryString -URI "$($ISPSSSession.tenant_url)/api/policies/validate" -SupportsDebug

        #Create Request Body
        $body = ConvertTo-JsonBody -Body @{ 'policyId' = $policyId }

        if ($PSCmdlet.ShouldProcess($policyId, 'Validate SCA Policy')) {

            #Send Request
            $result = Invoke-IDRestMethod -Uri $URI -Method POST -Body $body

            if ($null -ne $result) {

                #Report the status of the job started by the request
                $result | Resolve-SCAJobStatus

            }

        }

    }#process

    end { }#end

}