I was using the below code to connect to SQL Azure DB that was using Active Directory Integrated Authentication.
private string GenerateConnectionString(string databaseName, string serverName)
{
SqlConnectionStringBuilder connBuilder = new SqlConnectionStringBuilder();
sqlConnectionBuilder.DataSource = string.Format(
"tcp:{0}.database.windows.net",
serverName);
connBuilder.InitialCatalog = databaseName;
connBuilder.Authentication = SqlAuthenticationMethod.ActiveDirectoryIntegrated;
connBuilder.ConnectTimeout = 30;
return connBuilder.ConnectionString;
}
The authentication is changed from Active Directory Integrated Authentication to Active Directory Universal Authentication to support multi-factor authentication.
I see the enumeration
System.Data.SqlClient.SqlAuthenticationMethod
doesn't have a value for Active Directory Universal Authentication. Is it possible to still use the System.Data.SqlClient
to connect to the DB? If yes, what is
the change I have to do in the code?