From last few days I am looking for solution- I need to connect to Azure SQL MI server using service principal authentication through SSIS script task - C# code. I am using Microsoft.Data.SqlClient.dll v5.0.0, .net framework (by default) v4.7, Visual studio 2019, targetserverversion 2019. I have registered this dll to GAC. Also, below dependent dlls I have copied to below path and referencing it in code from there.
Microsoft.IdentityModel.Abstractions.6.21.0
Microsoft.Identity.Client.4.45.0
Microsoft.Identity.Client.Extensions.Msal.2.19.3
Microsoft.IdentityModel.Logging.6.21.0
Microsoft.IdentityModel.Tokens.6.21.0
Microsoft.IdentityModel.JsonWebTokens.6.21.0
Microsoft.IdentityModel.Protocols.6.21.0
System.Buffers.4.5.1
System.IdentityModel.Tokens.Jwt.6.21.0
Microsoft.IdentityModel.Protocols.OpenIdConnect.6.21.0
System.IO.4.3.0
System.Numerics.Vectors.4.5.0
System.Runtime.4.3.0
System.Runtime.CompilerServices.Unsafe.4.7.1
System.Memory.4.5.4
System.Diagnostics.DiagnosticSource.4.6.0
System.Runtime.InteropServices.RuntimeInformation.4.3.0
System.Security.Cryptography.Encoding.4.3.0
System.Security.Cryptography.Primitives.4.3.0
System.Security.Cryptography.Algorithms.4.3.1
System.Security.Cryptography.ProtectedData.4.7.0
System.Security.Cryptography.X509Certificates.4.3.0
System.Net.Http.4.3.4
System.Security.Principal.Windows.5.0.0
System.Security.AccessControl.5.0.0
System.Security.Permissions.5.0.0
System.Configuration.ConfigurationManager.5.0.0
System.Text.Encodings.Web.4.7.2
System.Threading.Tasks.Extensions.4.5.4
Microsoft.Bcl.AsyncInterfaces.1.1.1
System.ValueTuple.4.5.0
System.Text.Json.4.7.2
System.Memory.Data.1.0.2
Azure.Core.1.24.0
Azure.Identity.1.6.0
Microsoft.Data.SqlClient.5.0.0
But still I am getting below error (which seems something related to dll?)- Error: Object reference not set to an instance of an object.
Same C# code is working for service principal authentication method using in dotnet project. So there is no any ant code error. But when it comes to SSIS script task, it seems issue with dll installation.
Let me know if anyone has done this before and how or any suggestions. Thanks.