Search code examples
visual-studioactive-directoryazure-sql-databasemulti-factor-authentication

Active Directory Universal with MFA support not available when trying to connect from Visual Studio


I am using an Azure SQL for my application and from management studio I am connecting to the DB using Active Directory - Universal with MFA option from the dropdown as the authentication method. That connects the DB without any trouble enter image description here

But that method is not available when trying to connect to the DB from Visual Studio connection manager

Here is the screen grab

enter image description here

So how can I connect to my Azure DB with MFA from visual studio


Solution

  • This is possible in Visual Studio 2019, but is buried in the advanced connection options.

    • On the connection properties screen, fill out the information per your setup. You must leave the password blank (arrow 2) or you will get an error message.

    • Leave/Set the Authentication as “SQL Server Authentication” as step 4 will change this drop down back if it’s not already selected.

    • Next, click advanced and in the Security section, for the Authentication property, specify ActiveDirectoryInteractive (arrow 4).

    • Click Ok.

    • Once you test the connection or click ok to take the settings, you will get prompted with the interactive login from Microsoft and will be challenged for your password and MFA.

    • Screenshots of Property Screens