Lesson Learned #380:Unable to load adalsql.dll (Authentication=XYZ).Error code:0x2
Published Jun 23 2023 06:12 AM 6,206 Views

Analyzing a support case that our customer got the following error faced: "Unable to load adalsql.dll (Authentication=ActiveDirectoryPassword). Error code: 0x2" using an older application to the Azure SQL database. Following I would like to share my lessons learned about it. 

 

The error message "Unable to load adalsql.dll (Authentication=ActiveDirectoryPassword). Error code: 0x2" indicates a problem with loading the "adalsql.dll" file, which is related to Active Directory Authentication Library (ADAL) for SQL Server.

 

The error code "0x2" typically refers to the Windows system error code "ERROR_FILE_NOT_FOUND," indicating that the DLL file cannot be located.

 

Also, possible causes and solutions for this error include:

 

1. Missing or corrupted DLL file: It's possible that the "adalsql.dll" file is missing or corrupted. In such cases, you can try reinstalling the appropriate version of the library or repairing the installation if it's already installed.

 

2. Incorrect DLL file path: The SQL Server configuration might be pointing to an incorrect or inaccessible location for the "adalsql.dll" file. Ensure that the DLL file is located in the specified path and that the path is correctly configured in SQL Server settings.

 

3. Permissions issue: Ensure that the user running SQL Server has appropriate permissions to access and load the DLL file. The user account needs sufficient privileges to read and execute the DLL.

 

4. Compatibility issues: Check if the version of "adalsql.dll" you are using is compatible with the version of SQL Server you have installed. Ensure that you have the correct version of the library for your SQL Server version.

 

To resolve the error "Unable to load adalsql.dll (Authentication=ActiveDirectoryPassword). Error code: 0x2," you can try the following solutions:

 

Verify the presence of adalsql.dll: Confirm that the adalsql.dll file is present in the expected location or Reinstall or repair ADAL.  To Install the ADAL issue:

You can meet these requirements by:

  • Installing the latest version of SQL Server Management Studio or SQL Server Data Tools meets the .NET Framework 4.6 requirement.
    • SSMS installs the x86 version of ADAL.DLL.
    • SSDT installs the amd64 version of ADAL.DLL.
    • The latest Visual Studio from Visual Studio Downloads meets the .NET Framework 4.6 requirement, but does not install the required amd64 version of ADAL.DLL.

 

Enjoy!

Version history
Last update:
‎Jun 23 2023 07:15 AM
Updated by: