我们使用liquibase(Java)在Azure管道中运行以更新新部署的Azure SQL服务器上的SQL数据库,尽管使用的帐户可以毫无问题地登录到SSMS,但更新始终会失败并出现以下错误。
Liquibase Update Failed: Login failed for user 'useraccount'.. For more information, use the --logLevel flag)
2020-05-07T14:04:15.2730984Z [exec] May 07, 2020 2:04:15 PM liquibase.logging.jvm.JavaUtilLogger info
2020-05-07T14:04:15.2732159Z [exec] INFO: Login failed for user 'useraccount'.
2020-05-07T14:04:15.2732665Z [exec] liquibase.exception.DatabaseException: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'useraccount'.
2020-05-07T14:04:15.2743042Z [exec] at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:88)
2020-05-07T14:04:15.2769292Z [exec] at liquibase.integration.commandline.Main.doMigration(Main.java:603)
2020-05-07T14:04:15.2770567Z [exec] at liquibase.integration.commandline.Main.main(Main.java:110)
2020-05-07T14:04:15.2771290Z [exec] Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'devops-shr'.
2020-05-07T14:04:15.2771866Z [exec] at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197)
2020-05-07T14:04:15.2772443Z [exec] at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:246)
2020-05-07T14:04:15.2773654Z [exec] at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:83)
2020-05-07T14:04:15.2774188Z [exec] at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:2529)
2020-05-07T14:04:15.2774736Z [exec] at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:1905)
2020-05-07T14:04:15.2775303Z [exec] at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:41)
2020-05-07T14:04:15.2775883Z [exec] at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:1893)
2020-05-07T14:04:15.2776417Z [exec] at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575)
2020-05-07T14:04:15.2776961Z [exec] at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400)
2020-05-07T14:04:15.2778859Z [exec] at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1045)
2020-05-07T14:04:15.2779577Z [exec] at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:817)
2020-05-07T14:04:15.2780096Z [exec] at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:700)
2020-05-07T14:04:15.2780636Z [exec] at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:842)
2020-05-07T14:04:15.2781165Z [exec] at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:79)
此错误消息是故意含糊。 SQL Server不会告诉您为什么登录失败,因为您是经过身份验证且不受信任的客户端。
服务器错误日志或扩展事件将告诉您更多信息。最常见的两个错误是密码不正确,或者用户无法访问连接字符串中指定的数据库。