Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
retrieve_vault_password:
stage: retrieve
tags:
- windows
artifacts:
paths:
- windows-10/setup/Autounattend.xml
script:
- Write-Host "Retrieving Administrator password from Vault"
- $result = Invoke-RestMethod -Headers @{"X-Vault-Token" = ${env:VAULT_TOKEN}} -Method Get -Body $json -Uri ${env:VAULT_ADDR}/v1/creds/users/misc/administrator
- $pass = $result.data.Password
- Write-Host "Updating Autounattend.xml file with Administrator password"
- (Get-Content $xmlFile -Raw) -replace '{{password}}',$pass | Set-Content $xmlFile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment