Skip to content

Commit 0092c4b

Browse files
committed
add powershell m7
1 parent 5db8585 commit 0092c4b

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

m7/1-start-vault-agent.ps1

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Make sure you are in the m7 directory or this won't work very well
2+
3+
# Make sure your Vault server container is up and running
4+
docker container ls
5+
6+
# Let's set our vault env variables
7+
$env:VAULT_ADDR="https://127.0.0.1:8200"
8+
$env:VAULT_SKIP_VERIFY="true"
9+
10+
# Make sure vault isn't sealed
11+
vault status
12+
vault login
13+
14+
# We need to get the role-id and secret-id for the vault agent
15+
$role_id=$(vault read auth/approle/role/web-role/role-id -format=json) | ConvertFrom-Json
16+
17+
$secret_id=$(vault write -f auth/approle/role/web-role/secret-id -format=json) | ConvertFrom-Json
18+
19+
# Now we'll write both values out to files for use by the agent
20+
$role_id.data.role_id > role_id.txt
21+
$secret_id.data.secret_id > secret_id.txt
22+
23+
# Next we'll put a secret into the apikeys secrets engine
24+
vault kv put apikeys/key1 key=456yujnbgty678ikjhgty67u
25+
26+
# And now we can start up the vault agent
27+
vault agent -config=vault-agent.hcl

0 commit comments

Comments
 (0)