dbeaver
dbeaver copied to clipboard
Unable to Authenticate to Azure SQL with Active Directory MFA
System information:
- Operating system (distribution) and version: Windows 10 PRO
- DBeaver version: CE 22.0.2 (EA) , but also with stable version
- Additional extensions: none
Connection specification:
- Database name and version: Micosoft SQL Azure
- Driver name: com.microsoft.sqlserver.jdbc.SQLServerDriver 9.2.0
- Do you use tunnels or proxies (SSH, SOCKS, etc)? No
Describe the problem you're observing:
When I try to connect to the database, DBeaver return this the error:
Unexpected driver error occurred while connecting to the database com.microsoft.aad.msal4j.MsalClientException: java.net.UnknownHostException: login.windows.net com.microsoft.aad.msal4j.MsalClientException: java.net.UnknownHostException: login.windows.net java.net.UnknownHostException: login.windows.net java.net.UnknownHostException: login.windows.net login.windows.net login.windows.net
This is my driver configuration:
Steps to reproduce, if exist:
Include any warning/errors/backtraces from the logs
!ENTRY org.jkiss.dbeaver.model 4 0 2022-04-08 14:41:24.021
!MESSAGE login.windows.net
!SUBENTRY 1 org.jkiss.dbeaver.model 4 0 2022-04-08 14:41:24.021
!MESSAGE login.windows.net
!STACK 0
java.net.UnknownHostException: login.windows.net
at java.base/java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
at java.base/java.net.Socket.connect(Unknown Source)
at java.base/sun.security.ssl.SSLSocketImpl.connect(Unknown Source)
at java.base/sun.net.NetworkClient.doConnect(Unknown Source)
at java.base/sun.net.www.http.HttpClient.openServer(Unknown Source)
at java.base/sun.net.www.http.HttpClient.openServer(Unknown Source)
at java.base/sun.net.www.protocol.https.HttpsClient.
Hi,I installed the last version of DBEAVER ( 22.3.4.202302060909), tryed to reinstall all drivers... and the error is changed.
Here's all steps, after requesting a Connection from DBEAVER:
Inserting my credential:
Authenticate with Microsoft Authenticator:
There no response from server:
If I open Microsoft Edge Dev Tools there's this problem:
..and Dbeaver shows me this error:
Here's debug logs: dbeaver-debug.log
Thanks!
Thank you for update.
Hello @geuss
Please try to do this:
Go to "Edit Driver Settings," click the "Libraries" tab, then click "Add Artifact," then add the Maven dependency declaration:
<!-- https://mvnrepository.com/artifact/com.microsoft.azure/msal4j --> <dependency> <groupId>com.microsoft.azure</groupId> <artifactId>msal4j</artifactId> <version>1.11.3</version> </dependency>
https://github.com/dbeaver/dbeaver/issues/15446#issuecomment-1097140996
Thanks Anastasiya, It worked!! Only I had to specify a fixed address of "login.windows.net" on my hosts file:
20.190.159.69 login.windows.net
Without this configuration I had this error:
!ENTRY org.jkiss.dbeaver.model 4 0 2023-02-27 14:39:57.544
!MESSAGE java.net.UnknownHostException: login.windows.net
!SUBENTRY 1 org.jkiss.dbeaver.model 4 0 2023-02-27 14:39:57.544
!MESSAGE java.net.UnknownHostException: login.windows.net
!STACK 0
java.lang.RuntimeException: java.net.UnknownHostException: login.windows.net
at com.microsoft.sqlserver.jdbc.SQLServerMSAL4JUtils.getCorrectedException(SQLServerMSAL4JUtils.java:230)
at com.microsoft.sqlserver.jdbc.SQLServerMSAL4JUtils.getSqlFedAuthTokenInteractive(SQLServerMSAL4JUtils.java:195)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.getFedAuthToken(SQLServerConnection.java:5569)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.onFedAuthInfo(SQLServerConnection.java:5419)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.processFedAuthInfo(SQLServerConnection.java:5306)
at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onFedAuthInfo(tdsparser.java:306)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:126)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:37)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:6299)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:4911)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:4849)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7620)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:3916)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:3358)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2950)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2790)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1663)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1064)
at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.lambda$0(JDBCDataSource.java:206)
at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.lambda$1(JDBCDataSource.java:225)
at org.jkiss.dbeaver.utils.SecurityManagerUtils.wrapDriverActions(SecurityManagerUtils.java:96)
at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.openConnection(JDBCDataSource.java:223)
at org.jkiss.dbeaver.model.impl.jdbc.JDBCExecutionContext.connect(JDBCExecutionContext.java:103)
at org.jkiss.dbeaver.model.impl.jdbc.JDBCRemoteInstance.initializeMainContext(JDBCRemoteInstance.java:102)
at org.jkiss.dbeaver.model.impl.jdbc.JDBCRemoteInstance.
(perhaps a proxy issue...)
I close this issue.
Here my driver artifacts configuration (for all those with the same problem)
Thanks for the answer @geuss
I still get the error. What else can I do?
Hello @paulstegmann
Please provide the screen of your drivers. You can find this window in your connections settings -> Driver settings -> Libraries
HI @LonwoLonwo,
sure:
Hello @paulstegmann
Could you please try to update the msal4j library version? To 1.12.0
Additionally, you can try our DBeaver PRO version, which has special support for the Azure MFA. Try for free: https://dbeaver.com/trial/
Hi @LonwoLonwo,
thanks a lot, thats it! dbeaver is working again now.
Best!
Thanks for the answer @paulstegmann
Got the same problem in May, update the msal4j library version to 1.13.8, then problem is resolved.
Hello @geuss
Please try to do this:
Go to "Edit Driver Settings," click the "Libraries" tab, then click "Add Artifact," then add the Maven dependency declaration: <!-- https://mvnrepository.com/artifact/com.microsoft.azure/msal4j --> <dependency> <groupId>com.microsoft.azure</groupId> <artifactId>msal4j</artifactId> <version>1.11.3</version> </dependency>
Thanks a lot, you save me.