Skip to content

Instantly share code, notes, and snippets.

@konrness
Last active January 17, 2023 21:15
Show Gist options
  • Save konrness/382deee4b127290dfe94778654fd22ea to your computer and use it in GitHub Desktop.
Save konrness/382deee4b127290dfe94778654fd22ea to your computer and use it in GitHub Desktop.
Example of Querying the Thycotic Secret Server via Harness Custom Secret Manager script
access_token=$(curl -s --location --request POST 'https://<+secretManager.environmentVariables.hostname>/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'username=<+secrets.getValue("thycoticUsername")>' \
--data-urlencode 'password=<+secrets.getValue("thycoticPassword")>' \
--data-urlencode 'grant_type=password' | jq -r '.access_token')
secret=$(curl -s --location --request GET 'https://<+secretManager.environmentVariables.hostname>/api/v2/secrets/<+secretManager.environmentVariables.key>' \
--header "Authorization: Bearer $access_token" | jq -r '.items[] | select(.isPassword == true) | .itemValue')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment