hashicorp vault write json file code example

Example: vault Key-value insert from CLI

/*Put the value in the Vault from Powershell/CLI:-
I have put secret name second-secret and user and password as Ankit1 this would be 
by default referred as Version 1*/
 vault kv put secret/second-secret user=Ankit1

//Get or read the secret kv's this will provide only the latest version created 
 vault kv get secret/second-secret
//for specific version
 vault kv get -version=1 secret/second-secret
//Delete a particular version note here the  -version flag has "s"
 vault kv delete -versions=2 secret/second-secret
//Undelete the Version
 vault kv undelete -versions=2 secret/second-secret
//Permanently Destroy/Delete the version from secret
 vault kv destroy -versions=2 secret/second-secret
//Delete the secret 
 vault kv metadata delete secret/second-secret

//Get list of Secrets created 
 vault kv list secret
//Get metadata from particular secret created e.g here second-secret
 vault kv metadata get secret/second-secret

Tags:

Php Example