How can i connect to Azure SQL Database using Managed Identity?

I have setup Managed Identity on my App Service and given the database access.
I have a console app and used Microsoft.Data.SqlClient 3.0.1 as a nuget package that I test the connection as follows:

string ConnectionString1 = @"Server=demo-server.database.windows.net; 
Authentication=Active Directory Managed Identity; Encrypt=True; Database=DEMO";
using (SqlConnection conn = new SqlConnection(ConnectionString1))
{
    conn.Open();
}

But get the error ‘Invalid value for key authentication’
Can anyone help with this ?

Read more here: Source link