1

I've been looking to see if .NET 4.8.0 supports Azure Interactive Authentication for environments where MFA is used.

Looking online it says it's possible with the version of System.Data.SqlClient in 4.8.0.

https://learn.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqlauthenticationprovider.setprovider?view=netframework-4.8

But it seems it's only for managed identities in Azure. You can't seem to provide a connection string specifying "Authentication= Active Directory Interactive".

Just wondering if this is actually the case?

  • Please refer [Authentication options](https://learn.microsoft.com/en-us/azure/azure-sql/database/authentication-mfa-ssms-overview?view=azuresql#authentication-options) – Harshitha Aug 27 '22 at 12:11
  • SQL Server can use either a SQL username/password or a windows credential. The windows credential is the "Integrated" option in @HarshithaV link. Authentication the client automatically send the windows credentials to the server when a request is send from client to server. The connection string will contain either Integrated or Trusted when windows credentials is used. So make sure you connection string does not contain a user and password. – jdweng Aug 27 '22 at 14:47
  • So the connection string only has my email in and I'm specifying Interactive Authentication in the connection string. All I get back is this authentication type isn't supported. Looking online .NET 4.8.0 does support interactive authentication. – Tommy Newman Aug 28 '22 at 11:54
  • Please refer [SO Thread](https://stackoverflow.com/a/71438291) – Harshitha Aug 31 '22 at 11:50
  • Try with ODBC Connection.`OdbcConnection con = new OdbcConnection("Driver={ODBC Driver 17 for SQL Server};SERVER=tcp:myserver.database.windows.net;DATABASE=MyDb;Authentication=ActiveDirectoryInteractive;UID=example@example.com")` – Harshitha Aug 31 '22 at 11:52
  • Thanks, ODBC works fine as the driver supports the interactive authentication. It looks like the only way to get ADO which uses Microsoft.Data.SqlClient to work with MFA is to use a managed identity in Azure so register your application in Azure. ODBC seems the way to go for any sort of MFA interaction with Azure SQL Servers. – Tommy Newman Sep 01 '22 at 06:01

0 Answers0