Hashicorp Certified Vault Associate 002 · Free Practice Question Medium
Question 1
What command can be used to revoke all leases associated with a database role named prod-mysql?
-
A
vault lease revoke database/role/prod-mysql -
B
vault lease revoke -prefix database/creds/prod-mysql -
C
vault lease revoke database/creds/prod-mysql -
D
vault revoke database/role/prod-mysql
Reveal correct answer
Correct answer: B
Explanation
To immediately revoke all leases associated with a specific role, the user can run the command vault lease revoke -prefix database/creds/prod-mysql. All leases for this specific role will be revoked. This does NOT affect leases associated with other roles under the database/ mount.
https://developer.hashicorp.com/vault/docs/commands/lease/revoke#examples
A.
The command vault lease revoke database/role/prod-mysql is incorrect because it does not specify the correct path for revoking leases associated with a database role. The correct path should include the creds prefix for revoking leases associated with credentials.
B.
The correct command to revoke all leases associated with a database role named prod-mysql is vault lease revoke -prefix database/creds/prod-mysql. Using the -prefix flag allows you to revoke all leases that have a specific prefix, in this case, the database role prefix.
C.
The command vault lease revoke database/creds/prod-mysql is incorrect because it does not include the -prefix flag to revoke all leases associated with the database role named prod-mysql. The correct command should specify the prefix to revoke all associated leases.
D.
The command vault revoke database/role/prod-mysql is incorrect as it does not follow the correct syntax for revoking leases associated with a database role. The command should include the lease keyword and specify the correct path to revoke the leases.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
