SingleScripts/List-Secrets.ps1

[CmdletBinding()]
Param(
  [Parameter(Mandatory=$true,Position=1)] [string] $DBAPIRootUrl,
  [Parameter(Mandatory=$True,Position=2)] [string] $DBAPIKey,
  [Parameter(Mandatory=$True,Position=3)] [string] $Scope
)
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
$DBAPIUrl = $DBAPIRootUrl.Trim('/') + "/api/2.0/secrets/list"

$headers = @{
  Authorization = "Bearer $DBAPIKey"
  "Content-Type" = "application/json"
}

$DBAPIUrl = $DBAPIUrl + "?scope=$Scope"
  
Write-Information "Getting Secrets for Scope '$Scope' ..."
$result = Invoke-RestMethod -Uri $DBAPIUrl -Method GET -Headers $headers

$result