Azure-Samples/azure-spring-boot-samples

Working solution for Flyway missing when using password-less authentication towards Azure Postgres.

DanielWikman opened this issue · 2 comments

Is your feature request related to a problem? Please describe.

Yes, using password-less with managed identity or workload identity according to your guides together with Flyway fails
since Flyway picks up an HickariDataSource that is broken, and it will try to connect with an empty password to a password-less Postgres...

So what I end up doing is to create a subclass of HickariDataSource that returns a password
created by a ChainedCredentialBuilder... And a configuration class that creates that datasource. Then
that is passed successfully to Flyway...

Describe the solution you'd like

I would like an example of how to use these together without having to override half the datasource domain.
If I use your guides for passoword-less and set the spring.datasource.* and spring.cloud.azure.* according to
your guides Flyway should work out of the box.

Describe alternatives you've considered

As you saw above I got it working by overriding all your settings and autoconfigurations when creating my own
datasource...

Additional context

@DanielWikman could you help provide a project with minimal setups for us to reproduce the issue?

Would also be interested how that works. I always got the error: The server requested password-based authentication, but no password was provided by plugin null\ from the HikariDataSource