Skip to content

[BUG] PostgreSQL passwordless not work in Spring Cloud Azure 5.18.0 #43407

@rujche

Description

@rujche

Describe the bug
PostgreSQL passwordless not work in Spring Cloud Azure 5.18.0

Exception or Stack Trace

Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:84) ~[spring-jdbc-6.1.11.jar:6.1.11]
at org.springframework.jdbc.datasource.init.DatabasePopulatorUtils.execute(DatabasePopulatorUtils.java:52) ~[spring-jdbc-6.1.11.jar:6.1.11]
... 111 common frames omitted
Caused by: org.postgresql.util.PSQLException: FATAL: The access token does not have a valid audience claim. Please acquire a new token for the resource "https://ossrdbms-aad.database.windows.net".
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:698) ~[postgresql-42.7.3.jar:42.7.3]
at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:207) ~[postgresql-42.7.3.jar:42.7.3]
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:262) ~[postgresql-42.7.3.jar:42.7.3]
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:54) ~[postgresql-42.7.3.jar:42.7.3]

To Reproduce
Link to sample: https://github.com/azure-javaee/azure-spring-boot-samples/blob/7b200de74222628d47c216f2191950d97d70d664/postgresql/spring-cloud-azure-starter-jdbc-postgresql/spring-cloud-azure-postgresql-sample/pom.xml#L14

Use the SJAD version of azd, run azd init and azd up, this problem can be reproduced. Change Spring Cloud Azure's version from 5.18.0 to 5.16.0 can solve this problem.

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added

Metadata

Metadata

Assignees

Labels

MySQLazure-springAll azure-spring related issuesazure-spring-databaseSpring database related issues, like MySQL, PostgreSQL, and MSSQL.

Type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions