Microsoft Entra ID Authentication Error: Login Failed for User
Issue
While setting up an Azure SQL Database connection using the Microsoft Entra ID OAuth authentication method, the following error appears:
SQLServerException: Login failed for user
Environment
- Connector: Azure SQL Database
- Authentication method: Microsoft Entra ID OAuth
Resolution
To resolve this issue, do the following:
- Identify the user who most recently authorized the connection in Fivetran.
This information isn't available in Fivetran. Check internally with your team to determine the authorizing user.
- Locate and make a note of this user's email address in Microsoft Entra ID.
- Add the user to your Azure SQL Database instance using the same email address. Run the following command, replacing
<email_address>with the actual email address:CREATE USER [<email_address>] FROM EXTERNAL PROVIDER;
Cause
We use the Microsoft Entra ID email address of the user who authorizes the connection to authenticate with Azure SQL Database. Authentication fails if a user with a matching email address doesn't exist in the database.
Therefore, this issue occurs when the authorizing user exists in Microsoft Entra ID but hasn't been added to your Azure SQL Database instance.