Unable to connect Azure SQL database from Spring boot using AD user

183 Views Asked by At

I have enabled the AADAuthencationOnly and I am able to connect via SQL Server Management Studio. But when I am trying to connect the database from spring boot application but I am getting below error when I am using com.microsoft.sqlserver:sqljdbc4:4.0 or com.microsoft.sqlserver:mssql-jdbc:12.4.2.jre11

com.microsoft.aad.msal4j.MsalClientException: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

application.yml

    url: jdbc:sqlserver://xz.database.windows.net:1433;database=xz;authentication=ActiveDirectoryPassword;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;
    username: [email protected]
    password: Ok0qYszsGPhM5trLIxHZBDdQbvxyJ2mnrRnbXRYN30OrCEX2nHCoqKsX

Spring boot Version : 2.7.8

How can I resolve this issue. If I want to use the certificates, where can i download the certificates for Azure SQL database?

0

There are 0 best solutions below