Product: PowerShell Universal
Version: 4.5.5
I created an app to create secret variables using Api calls in our lab, which doesn’t have one-way gitsync on, and it’s working great. Here is a snippet of the pertinent code:
Invoke-RestMethod http://localhost:5000/api/v1/signin -Method POST -Body ( @{ username=$Secret:XXXXXX.UserName password=$Secret:XXXXXX.GetNetworkCredential().Password} | ConvertTo-Json ) -SessionVariable SessionVar -ContentType ‘application/json’
$Body = @{
name = $Eventdata.SecretStringName
type = ‘System.String’
value = $Eventdata.SecretStringValue
vault = ‘Database’
}
Invoke-RestMethod -Uri http://localhost:5000/api/v1/variable -Method POST -ContentType ‘application/json’ -Body ($Body | ConvertTo-Json) -WebSession $SessionVar
When I try running the same app on our server with one-way git sync enabled I am getting an error: “The remote server returned an error: (400) Bad Request.”
It appears it is not possible to create variables in a One-Way Git Sync environment even via Api? Unless I’m missing something? What would be the Ironman Software recommended best way to create new secret variables in a one-way sync environment?