Public/Policies/Remove-SCAAccessPolicy.ps1
|
function Remove-SCAAccessPolicy { <# .SYNOPSIS Deletes an access control policy. .DESCRIPTION Calls DELETE /policies/{policyId} on the Access Control Policies API. .PARAMETER PolicyId The policy to delete. .PARAMETER Session A psSCA.Session object or session name. Defaults to the current default session. .EXAMPLE Remove-SCAAccessPolicy -PolicyId 'a1b2c3d4-policy-id' Deletes the specified policy after confirmation. .INPUTS System.String. PolicyId can be piped in by value or by property name. .OUTPUTS None. .LINK https://api-docs.cyberark.com/uap-schema-api/docs/access-control-policies-api #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] [OutputType([void])] param( [Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] [Alias('id')] [string]$PolicyId, [Parameter()] [object]$Session ) process { if ($PSCmdlet.ShouldProcess($PolicyId, 'Delete Secure Cloud Access policy')) { Invoke-SCARequest -Session $Session -Service 'UAP' -Method DELETE -Path '/policies/{policyId}' ` -PathParameters @{ policyId = $PolicyId } -Operation 'Remove-SCAAccessPolicy' | Out-Null } } } |