VAULT-ASSOCIATE practice question 12 of 15

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"?

Full set: 57 questions
Answer options
A: vault kv put secret/my-secrets/my-password 53cr3t
B: vault kv write secret/my-secrets/my-password 53cr3t
C: vault kv write 53cr3t my-secrets/my-password
D: vault kv put secret/my-secrets »y-password-53cr3t Correct answer
Correct Answer:
D. vault kv put secret/my-secrets »y-password-53cr3t
Explanation

The correct command syntax to write data to the Key-Value (KV) secrets engine is vault kv put PATH KEY=VALUE.
- The secrets engine is mounted at secret.
- The path for the secret is my-secrets.
- The key is my-password.
- The value is 53cr3t. Combining these elements results in the command: vault kv put secret/my-secrets my-password=53cr3t. Option D is the only choice that correctly identifies secret/my-secrets as the path and separates it from the key-value data, despite the apparent typo.

Why Incorrect

A. This command incorrectly appends the intended key (my-password) to the path and fails to use the required key=value format for the data.
B. This command uses the write alias for put but makes the same syntactical error as option A, confusing the path and the data payload.
C. This command has the arguments in the wrong order. The path must come before the key-value data, and the data must be in key=value format.

References

1. HashiCorp Vault Official Documentation, CLI Commands, kv put: The documentation specifies the command usage as vault kv put [options] PATH KEY=VALUE [KEY=VALUE ...]. This confirms that the path (secret/my-secrets) must be followed by one or more key-value pairs in the KEY=VALUE format.

- Source: HashiCorp, "Vault Commands (CLI) - vault kv put", Vault Documentation. Accessed under the "Command Usage" section.

2. HashiCorp Learn, "Static Secrets: Key/Value Secrets Engine" Tutorial: This official tutorial provides practical examples of writing secrets. For instance, vault kv put secret/webapp/config username="static-user" password="static-password". This example clearly separates the path (secret/webapp/config) from the key-value pairs, reinforcing the correct structure found in option D.

- Source: HashiCorp Learn, "Static Secrets: Key/Value Secrets Engine", Step 2: "Write a Secret".

Scroll to Top