Not able to login through Azure Active Directory through C# .Net Core Application
I need to want to use Azure Active Directory User to login to the DB instead of SQL Login. The user should have access as per the privileges that are provided to him e.g. read/write, readonly, etc. I have written the code below but I am getting an exception:
string ConnectionString = @"Server=tcp:predictive-wxmstocxodfjc-dms.database.windows.net;" +
@" Authentication=Active Directory Integrated; Encrypt=True; User Id=UserId; ";
using (SqlConnection conn = new SqlConnection(ConnectionString))
{
conn.Open();
}
The user has read/write access.
Exception:
Microsoft.Data.SqlClient.SqlException (0x80131904): Failed to authenticate the user UserId in Active Directory (Authentication=ActiveDirectoryIntegrated).
Error code 0xunknown_user_type
Unsupported User Type 'Unknown'. Please see https://aka.ms/msal-net-up
Can I please get some help on this. Thanks.
Read more here: Source link