Hi,
I have a vault set-up on my Ubuntu machine and I'm trying to connect to it using PowerShell on a windows machine. Both the machines are on the same network. I have tried the curl commands on the Ubuntu machine and they work fine. When I tried running the Invoke-Rest command it throws this error:
Invoke-RestMethod : Unable to connect to the remote server
At C:\Users\Administrator\Documents\test_connection.ps1:12 char:1
+ Invoke-RestMethod -Headers @{"X-Vault-Token" = ${env:VAULT_TOKEN}} -Method Post ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : System.Net.WebException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Here is the code I'm trying to run-
$env:VAULT_TOKEN="s.PppriCFG0FysCxyNxWNqhC5Z"
$USERNAME="test"
$pass=ConvertTo-SecureString -String "test@123" -AsPlainText –Force
$JSON="{ `"options`": { `"max_versions`": 12 }, `"data`": { `"$USERNAME`": `"$pass`" } }"
Please suggest.