SingleScripts/Set-Secret.ps1
[CmdletBinding()] Param( [Parameter(Mandatory=$true,Position=1)] [string] $DBAPIRootUrl, [Parameter(Mandatory=$True,Position=2)] [string] $DBAPIKey, [Parameter(Mandatory=$True,Position=4)] [string] $Scope, [Parameter(Mandatory=$True,Position=5)] [string] $Name, [Parameter(Mandatory=$True,Position=6)] [string] $Value ) [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 $DBAPIUrl = $DBAPIRootUrl.Trim('/') + "/api/2.0/secrets/put" $headers = @{ Authorization = "Bearer $DBAPIKey" "Content-Type" = "application/json" } $body = @{ scope = $Scope key = $Name string_value = $Value } $bodyJson = $body | ConvertTo-Json Write-Information "Creating Secret '$Name' in Scope '$Scope' ..." $result = Invoke-RestMethod -Uri $DBAPIUrl -Method POST -Headers $headers -Body $bodyJson $result |