2
votes

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

2

2 Answers

2
votes

SSMS and SqlPackage.exe are the only tools currently enabled for MFA through Active Directory Universal Authentication.

Visual studio doesn't support it.

Ref: Universal Authentication limitations

2
votes

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 - Sorry, I can't embed images.