Set secret variable One-Way Git Sync

How can we create secret variables with One-Way Git sync. I am unable to create variables with New-UAVariable error returning 400. We can create secret variables with Two-Way git sync via management api and ui.

Thanks

Product: PowerShell Universal
Version: 2.5.0

I think we need to update that cmdlet…

To use the management API, you’ll need to use the api/v1/variable/secret endpoint. If you issue a PUT to the endpoint with the JSON for the variable you are trying to update, it should set the secret.

$Variable = Get-PSUVariable -Name 'MySecret'
$Variable.UserName = "test"
$Variable.Password = "test"

Invoke-RestMethod -Body ($Variable | ConvertTo-Json) -Method PUT -Uri http://localhost:5000/api/v1/variable/secret 

We’re calling that endpoint in the admin console to update variables.

Awesome. That worked.

Thanks @adam