我可以使用 System.Data.SqlClient 提供程序与 Azure SQL 托管实例建立连接吗?其他 SQL 数据库怎么样?

Can I use the System.Data.SqlClient provider to establish a connection with an Azure SQL Managed Instance? How about other SQL DBs?

我可以使用 System.Data.SqlClient 提供程序的连接字符串来连接到 Azure SQL 托管实例吗?或者只是到 Microsoft SQL 服务器?

如果是这样,我还应该使用 Windows 身份验证吗?

谢谢,

您可以使用 System.Data.SqlClient 连接到托管实例。

但是,我们建议您改用更新的 Microsoft.Data.SqlClient

您可以使用 AD 集成身份验证或 Azure AD Service Principal 身份验证

第三方编辑

来自dotnet/SqlClient

Microsoft.Data.SqlClient is a data provider for Microsoft SQL Server and Azure SQL Database. Now in General Availability, it is a union of the two System.Data.SqlClient components which live independently in .NET Framework and .NET Core. Going forward, support for new SQL Server features will be implemented in Microsoft.Data.SqlClient.

如果您从 System.Data.SqlClient 切换到 Microsoft.Data.SqlClient,您必须注意一些 porting todos

FAQ 有一些额外的信息。