runtime: Azure Functions - System.Data.SqlClient is not supported on this platform
Hi Team,
When using System.Data.SqlClient ( 4.6.0-preview-versions ) with azure functions, following exceptions is being thrown.
4.6.0-preview3-27014-02
System.Private.CoreLib: One or more errors occurred. (System.Data.SqlClient is not supported on this platform.). System.Data.SqlClient: System.Data.SqlClient is not supported on this platform
Downgrading the version to 4.5.1 works fine.
Tried with 2.2.100-preview2-009404
SDK too, still getting the same exception.
I am using the preview version because we need to use the AAD accesstoken property on SqlConnection
Object.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 43 (11 by maintainers)
Got the problem with 4.7.0 today. And the Microsoft.Data.SqlClient gives me the same error
This local.settings.json:
and additional targets:
“fixed” this for me.
Same issue here: “System.Data.SqlClient” Version=“4.7.0”. Quite disappointing. We have been evaluating .Net Core, Azure functions for a large enterprise project. Strange issues with other .Net Core-based libraries as well. Things just look too flaky for a long term commitment.
I can confirm. Downgrading to 4.6.1 resolved this issue for me as well.
@ryancole @danimal521 I downloaded 4.6.1 (prod release), the error is gone. Thanks for sharing the solution.
@ryancole that totally worked! I used 4.5.1 seemed to be the last prod build.
@danimal521 I was able to resolve the issue by downgrading the
System.Data.SqlClient
library by one release. It seems to have been in an issue in the release.I’m using the latest (non-preview) version, but still the azure function is throwing the exception.
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.0" /> --> Has a dependency on 4.6.0I assume it’s no longer preview ?
4.5.1 might “solve” (workaround) the issue as stated in the title. Reverting back form the 4.6 will result in the issue that one will not be able to use AAD auth ;
So using AAD auth towards Azure SQL is not possible in combination with Azure Functions…