VAULT-ASSOCIATE-002 · Question #74
What command creates a secret with the key "my-password" and the value "53cr3t" at path "my- secrets" within the KV secrets engine mounted at "secret"?
The correct answer is A. vault kv put secret/my-secrets/my-password 53cr3t. The command vault kv put secret/my-secrets/my-password 53cr3t correctly creates a secret named 'my-password' with the value '53cr3t' at the specified path.
Question
Options
- Avault kv put secret/my-secrets/my-password 53cr3t
- Bvault kv write secret/my-secrets/my-password 53cr3t
- Cvault kv write 53cr3t my-secrets/my-password
- Dvault kv put secret/my-secrets my-password-53cr3t
How the community answered
(45 responses)- A91% (41)
- B4% (2)
- C2% (1)
- D2% (1)
Why each option
The command `vault kv put secret/my-secrets/my-password 53cr3t` correctly creates a secret named 'my-password' with the value '53cr3t' at the specified path.
For Vault's Key-Value secrets engine, particularly version 1 (KVv1) or when creating a simple secret with a single value, the command `vault kv put <path>/<secret_name> <value>` is used. This command creates a secret identified by the full path `secret/my-secrets/my-password` and assigns "53cr3t" to its default `value` field.
While `vault kv write` can be used, the provided syntax for assigning a key-value pair as described is less standard than `vault kv put` for directly setting a single secret value.
The command order is incorrect; `vault kv write` expects the path before the key-value arguments, not the value first.
This command would create a secret at `secret/my-secrets` with its default `value` field set to `my-password-53cr3t`, rather than creating a key named "my-password" with the value "53cr3t".
Concept tested: Vault KV secret creation syntax (KVv1)
Source: https://developer.hashicorp.com/vault/docs/commands/kv/put
Topics
Community Discussion
No community discussion yet for this question.