Public/Risk/Get-SCARiskRecommendation.ps1
|
function Get-SCARiskRecommendation { <# .SYNOPSIS Lists risk-reduction recommendations. .DESCRIPTION Calls GET /recommendations on the Risk Management API to list recommendations for reducing standing-privilege risk, or GET /recommendations/{recommendationType}/by-tags to get the count of tagged entities under a specific recommendation. .PARAMETER RecommendationType Get the tagged-entity count for a single recommendation type instead of listing all recommendations. .PARAMETER Session A psSCA.Session object or session name. Defaults to the current default session. .EXAMPLE Get-SCARiskRecommendation Lists every risk-reduction recommendation for the tenant. .EXAMPLE Get-SCARiskRecommendation -RecommendationType 'RemoveUnusedRole' Gets the tagged-entity count for a specific recommendation type. .INPUTS None. .OUTPUTS psSCA.RiskRecommendation .LINK https://api-docs.cyberark.com/risk-management-api/docs/risk-management-api #> [CmdletBinding()] [OutputType('psSCA.RiskRecommendation')] param( [Parameter()] [string]$RecommendationType, [Parameter()] [object]$Session ) if ($RecommendationType) { Invoke-SCARequest -Session $Session -Service 'Compass' -Method GET -Path '/recommendations/{recommendationType}/by-tags' ` -PathParameters @{ recommendationType = $RecommendationType } -Operation 'Get-SCARiskRecommendation' -TypeName 'psSCA.RiskRecommendation' } else { Invoke-SCARequest -Session $Session -Service 'Compass' -Method GET -Path '/recommendations' ` -Operation 'Get-SCARiskRecommendation' -TypeName 'psSCA.RiskRecommendation' } } |