How do I connect using Active Directory integrated authenticiation?

When connecting to our Azure SQL server using SQL Compare's option for "Active Directory integrated authentication", I get this error message: Unable to load adalsql.dll (Authentication=ActiveDirectoryIntegrated). Error code: 0x2. For more information, see http://go.microsoft.com/fwlink/?LinkID=513072

I went to the URL and installed the software from Microsoft, restarted, and still get the same error.

Please note that SQL Server Management Studio (SSMS) is able to connect to this server using "Active Directory - Integrated" authentication method. Also, please note I can connect using SQL Compare's "SQL Server authentication" with a different account, but this account has different permissions and is not my desired account.


Tagged:

Best Answer

  • Alex BAlex B Posts: 955 Diamond 3
    Accepted Answer
    Hi @scott_d,

    It seems the dll may either not be registered in the GAC or that the existing one may be buggy.   We found this Stack Overflow article and this page as well that describe removing the current one and installing the latest from the link that was in the error message.

    Can you please try this and let me know if you are then able to connect using Azure AD?

    Kind regards,
    Alex
    Product Support Engineer | Redgate Software

    Have you visited our Help Center?

Answers

  • Alex BAlex B Posts: 955 Diamond 3
    Hi @scott_d,

    What version of SQL Compare are you using and what version of adalsql does it say you now have in Programs and Features? 

    This should have been implemented from v12.4.9 though we have seen where differing versions of the adalsql caused an issue (in earlier V13 SQL Compare).

    Also what OS and SSMS version do you have?

    Kind regards,
    Alex
    Product Support Engineer | Redgate Software

    Have you visited our Help Center?
  • scott_dscott_d Posts: 3 New member
    • Redgate SQL Compare v13.7.16
    • Active Directory Authentication Library for SQL Server 15.0.1300.359
    • Active Directory Authentication Library for SQL Server (x86) 13.0.1300.275
    • OS Windows 10 v1903
    • SSMS v18.1

  • scott_dscott_d Posts: 3 New member
    This worked. I uninstalled both instances of "Active Directory Authentication Library for SQL Server": x86 and 64 bit. Then re-installed the 64 bit version. Since it's the same version that was previously installed, I suspect it was the x86 version causing the problems. Also, note that even though SQL Compare is x86, the 64 bit adalsql.dll works for my system.

    Thank you for finding this solution.
Sign In or Register to comment.