Skip to content

Instantly share code, notes, and snippets.

@virtualhobbit
Created November 6, 2020 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save virtualhobbit/13d91570b49011aa1dec9de52d36c013 to your computer and use it in GitHub Desktop.
Save virtualhobbit/13d91570b49011aa1dec9de52d36c013 to your computer and use it in GitHub Desktop.
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