'Can I use the System.Data.SqlClient provider to establish a connection with an Azure SQL Managed Instance? How about other SQL DBs?
Can I use a connection string with the System.Data.SqlClient
provider to connect to an Azure SQL Managed Instance? Or just to a Microsoft SQL Server?
If so, should I still use the Windows authentication?
Thanks,
Solution 1:[1]
You can use System.Data.SqlClient to connect to Managed Instance.
However, we recommend that you switch to the newer Microsoft.Data.SqlClient instead.
You can use AD Integrated authentication or Azure AD Service Principal authentication
3rd party edit
From 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.
If you switch from System.Data.SqlClient to Microsoft.Data.SqlClient you have to take care of some porting todos
The FAQ has some additional infos.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | surfmuggle |