Press "Enter" to skip to content

Configuration Advice for Using EF Core with Azure SQL DB

Erik Ejlskov Jensen has some advice if you’re using Entity Framework Core with Azure SQL Databases:

If you are connecting from .NET Framework with EF Core 2.x, use .NET 4.6.2 or later. If there are connection errors with this version or newer, the client will retry immediately, and handle transient connection errors gracefully.

If you are using EF Core 3.x, update to 3.1.7 or newer to take advantage of bug fixes in the Microsoft.Data.SqlClient dependency, that has been updated to version 1.1.3. For older EF Core versions, you can opt-in to a newer version (ever 2.0.0 or higher) as described in my blog post.

If you are using EF Core 5, you get the version 2.0.1. Microsoft.Data.SqlClient, which includes advanced Azure Active Directory authentication options.

Click through for more tips, including how to set up automated retry of commands.