I am trying to connect to Azure db with Azure AD credentials through c# code (Code is below). It works fine on my system. But when I deploy it to a 32 bit VM, it shows error
"Keyword not supported : authentication".
The VM has .Net framework 4.5 installed (But not Visual Studio). Application is targeting .Net Framework 4.5.
As per my observations, system.data for framework 2.0 does not support authentication keyword for SQLConnection class. But my application is targetting 4.5 , so it should work fine with 4.5 installed. can anyone help to resolve it. Below is my code
class Program
{
static void Main(string[] args)
{
try
{
string ConnectionString =
@"Data Source=mydatabase.database.windows.net; Authentication=Active Directory Password; UID=user.name@microsoft.contoso.com; PWD=Test@pswd";
SqlConnection conn = new SqlConnection(ConnectionString);
conn.Open();
Console.WriteLine("connected");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.ReadKey();
}
}