Public/Access/Get-SCAEligibleTarget.ps1
|
function Get-SCAEligibleTarget { <# .SYNOPSIS Lists cloud targets the caller is eligible to request zero-standing-privilege access to. .DESCRIPTION Calls the Secure Cloud Access Access API (GET /access/{csp}/eligibility) to list the AWS accounts, Azure subscriptions, or GCP projects the authenticated identity currently has standing eligibility for, based on the access policies assigned to them. .PARAMETER Provider The cloud service provider to query: AWS, Azure, or GCP. .PARAMETER Session A psSCA.Session object or session name. Defaults to the current default session. .EXAMPLE Get-SCAEligibleTarget -Provider AWS Lists AWS targets the current identity is eligible to elevate access to. .EXAMPLE Get-SCAEligibleTarget -Provider Azure | Where-Object subscriptionId -eq '11111111-1111-1111-1111-111111111111' Filters eligible Azure targets down to a specific subscription. .INPUTS None. .OUTPUTS psSCA.EligibleTarget .LINK https://api-docs.cyberark.com/sca-api/docs/secure-cloud-access-apis #> [CmdletBinding()] [OutputType('psSCA.EligibleTarget')] param( [Parameter(Mandatory)] [ValidateSet('AWS', 'Azure', 'GCP')] [string]$Provider, [Parameter()] [object]$Session ) $csp = $Provider.ToLowerInvariant() Invoke-SCARequest -Session $Session -Service 'SCA' -Method GET -Path '/access/{csp}/eligibility' ` -PathParameters @{ csp = $csp } -Operation 'Get-SCAEligibleTarget' -TypeName 'psSCA.EligibleTarget' } |