Revoking one lease, a prefix or everything a token created, the -force and -sync options, and what revocation does to the secret at its source.
Study it
Revoking leases: one lease, a prefix, or everything a token made
Lesson coming
Sample questions
Try each one before opening the answer. Every option is explained, with the HashiCorp documentation page that proves it.
Question 1 · choose 1
The database behind the database/ mount was decommissioned before its leases were revoked. vault lease revoke -prefix database/creds now fails because Vault cannot reach the database to drop the users, and the leases stay in Vault. The team accepts that the users are already gone and wants Vault to discard those leases. Which command does it?
Avault lease revoke -force database/creds/app/<lease_id> for each lease
Bvault lease revoke -sync -prefix database/creds
Cvault write -f sys/leases/tidy
Dvault lease revoke -force -prefix database/creds
Show the answer and why
Avault lease revoke -force database/creds/app/<lease_id> for each lease
Incorrect
-force is accepted only together with -prefix, so a single lease ID does not work.
Bvault lease revoke -sync -prefix database/creds
Incorrect
The engine call would still fail, so the leases would stay.
Cvault write -f sys/leases/tidy
Incorrect
Tidy revokes leases that lack a valid token, and those revocations still go through the unreachable database.
Dvault lease revoke -force -prefix database/creds
Correct
-force deletes the leases even when the engine's revocation fails, and it must be used with -prefix.
Forced revocation ignores backend errors, so Vault stops tracking secrets it could not clean up. Use it only when the secrets are known to be gone.
A cleanup script runs vault lease revoke database/creds/app/<lease_id>, which reports success, and at once queries the database for the user. For a few seconds the user still exists. Why, and how can the script wait for the revocation to finish?
ARevocations are queued in the background by default; add -sync to wait
BThe database caches users; the script must flush its connection pool
CVault revokes the lease but leaves dropping the user to the DBA
DThe user is dropped only when the lease's TTL ends; revoke again with -prefix
Show the answer and why
ARevocations are queued in the background by default; add -sync to wait
Correct
-sync makes the operation synchronous instead of queuing the revocation to be done in the background.
BThe database caches users; the script must flush its connection pool
Incorrect
The delay comes from Vault queuing the revocation, not from the database.
CVault revokes the lease but leaves dropping the user to the DBA
Incorrect
Revocation drops the user through the engine; it is only queued, not skipped.
DThe user is dropped only when the lease's TTL ends; revoke again with -prefix
Incorrect
Revocation does not wait for the TTL, and -prefix only widens which leases are matched.
By default vault lease revoke queues the revocation and returns; scripts that check the target system right away should use -sync.