Scrivio Interview library
LeadershipPrincipal6 min read · updated 12 November 2026

Your company plans to move from long-lived database passwords in configuration to short-lived, identity-based credentials over several years. How would you plan this, and what risks would you manage?

I would start with workload identity where the platform already supports it, such as cloud IAM database authentication or Vault dynamic secrets, and make sure applications can handle renewal, because the connection pool must reconnect with new credentials before the old ones expire. The secret store becomes critical infrastructure, so it needs high availability and break-glass access. We migrate in waves with an audit of the static secrets that remain, and we measure progress by the number and age of static secrets left.

Why this question is asked

A long-lived database password is a standing risk: if it leaks, it works until someone notices and rotates it, which may be months. Short-lived, identity-based credentials change that: a service proves who it is, receives a credential that expires in minutes or hours, and a leaked credential is soon useless. Interviewers ask this of senior leaders because the move touches every service, the platform and the database teams, and it fails in surprising ways, such as connection pools holding expired credentials or a secret store outage stopping every startup. In this answer, we will recap what identity-based credentials are, decide where to start, look at what applications must change, plan for the store as critical infrastructure, and lay out the waves and the measures.

1A Quick Recap of Identity-Based Credentials

With a static password, possession is identity: whoever holds the string can connect. With identity-based credentials, the workload first proves who it is using something the platform gives it, such as a Kubernetes service account token or a cloud IAM role. A trusted system then issues a credential for the database that is valid only for a short time.

There are two common forms. In cloud IAM database authentication, the application asks the cloud for a token, valid for minutes, and uses it as the database password; the database checks it with the cloud. With Vault dynamic secrets, Vault creates a real database user with a lease, perhaps one hour, renews it while the service runs, and drops the user when the lease ends.

Step throughConnecting with a short-lived credential
ServiceIdentity / VaultDatabase
prove identity (service account or IAM role)
credential valid for 15 minutes to 1 hour
open pool connections with it
renew or fetch a new credential before expiry
new connections use the new credential
old credential expires or user is dropped

6 messages in order. Play them, or step through them one at a time.

Renewal is the new responsibility the application takes on.

2Where to Start

We start where the platform does most of the work. Managed databases in the cloud often support IAM authentication directly, and services already running with a cloud identity can use it with a driver plugin or wrapper, so the change is small. For self-managed databases, or when we run in several clouds, Vault's database secrets engine gives the same model with one tool.

The first wave should be a few services that are well maintained, on a recent Spring Boot version and owned by teams willing to report problems. They prove the libraries, the pool settings and the runbooks before we ask hundreds of teams to follow.

3What Applications Must Handle

The biggest technical change is renewal. A connection pool such as HikariCP creates connections with the credentials it was given at startup and keeps them for a long time. An open connection usually stays valid after its credential expires, because authentication happened when it was opened, but every new connection needs a current credential. So the pool must obtain fresh credentials for new connections, and old connections must be retired before the database user behind them is dropped.

Java
spring:
datasource:
hikari:
max-lifetime: 1800000 # 30 minutes in ms, shorter than the credential's lifetime (e.g. 1h lease)
keepalive-time: 300000 # 5 minutes in ms
# Option A: Spring Cloud Vault database support renews the lease while the app runs;
# check how your version updates the pool when a new credential is issued.
# Option B: a cloud JDBC wrapper or plugin fetches an IAM token for every new connection.
# Option C: a sidecar writes a fresh credential file; the app reloads it for new connections.

Notice the relation between the numbers: if the credential lives an hour and the pool retires connections after 30 minutes, every connection is replaced at least once while its credential is still valid. The details depend on the library, so we validate them in the first wave with a test that runs past several expiries under load and watches for authentication errors.

4The Secret Store Becomes Critical Infrastructure

Once services fetch credentials at startup and renew them while running, the store or identity service is on the critical path of every database connection. If Vault is down for an hour and leases are one hour long, services start failing as their credentials expire, and no new pod can start at all.

So we plan for it like a database: a highly available cluster across zones, monitoring of issue and renewal latency, capacity for a full fleet restart, and tested backup and restore. We also need break-glass access, a documented and audited way for a small group to reach the databases with an emergency credential when the store itself is broken, kept in a sealed location and rotated after each use. Lease lengths become a resilience lever: longer leases give more time to recover from a store outage, shorter leases reduce the value of a leak.

5Migrating in Waves and Measuring Progress

After the first wave, we migrate in waves grouped by platform and risk, for example cloud-managed databases first, then self-managed ones, then legacy systems. Each wave ends with an audit of the static secrets that remain: every database user with a password that never expires, where it is used and why. Some will stay for a long time, such as reporting tools or vendor systems; each gets an owner, a reason and a rotation schedule.

We measure progress with two numbers: how many static database credentials remain, and how old they are. The count shows coverage; the age shows risk, because a static password rotated last week is far less dangerous than one set five years ago. Both should fall wave by wave, and both make good targets for the leadership report.

Waves of the migration
WaveScopeExit check
1: pilot3 to 5 well-maintained servicesno auth errors over several expiries
2: cloud-managed DBsservices on IAM-capable databasesstatic users for them revoked
3: self-managed DBsVault dynamic secretsstatic users for them revoked
4: legacy and vendorscase by caseeach remaining secret owned and rotated

6Follow-up questions

What is the biggest risk you would manage?

That the store becomes a single point of failure for every database connection. I would manage it with high availability, lease lengths that leave time to recover, monitoring of renewal, and a tested break-glass procedure, before moving critical services onto it.

How do you handle batch jobs or tools that run for hours?

They need the same renewal behaviour as services, or leases longer than their run time. A job that opens one connection for six hours with a one-hour credential usually keeps working, because the connection was authenticated when opened, but any reconnect after expiry fails, so the job should fetch a new credential when it reconnects.

How would you convince teams the change is worth it?

By making it cheap and showing the benefit: a starter and pool settings that work out of the box, a pilot that proves it, and the clear gain that their service no longer has a password to rotate, leak or explain to auditors.

7Conclusion

In this answer, we planned a move from long-lived database passwords to short-lived, identity-based credentials. We start with workload identity where the platform supports it, cloud IAM authentication or Vault dynamic secrets, and make applications handle renewal so connection pools reconnect with fresh credentials before old ones expire. The secret store becomes critical infrastructure with high availability and break-glass access. We migrate in waves with an audit of the remaining static secrets, and measure progress by their number and age.

What to say in the interviewAbout 90 seconds aloud

Open with

I would plan it as a multi-year programme in waves. First, I start where the platform does most of the work: cloud IAM database authentication for managed databases, and Vault dynamic secrets for self-managed ones.

Then, if they want more

A service proves its identity with its service account or IAM role and gets a credential that lives for minutes or an hour. The first wave is a few well-maintained services that prove the libraries and settings. The main application change is renewal.

A pool like Hikari opens connections with the credential it has, so it must get fresh credentials for new connections, and the max lifetime must be shorter than the credential lifetime so old connections are retired in time. I would test that under load across several expiries. The biggest risk is that the secret store becomes critical infrastructure.

If it is down longer than the lease, services start failing and new pods cannot start. So it needs high availability across zones, monitoring of renewals, lease lengths that leave time to recover, and a tested break-glass procedure for emergency database access. Then I migrate in waves, cloud-managed databases first, then self-managed, then legacy and vendor systems.

After each wave I audit the static secrets that remain, give each an owner and a rotation schedule, and track the number and the age of static secrets left as the main progress measures.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Spring Boot reference
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Your company plans to move from long-lived database passwords in configuration to...": https://scrivio-interview-library.netlify.app/spring-boot/externalized-configuration/b9165c2f35/