Using Entra ID in a C# program to allow access to an Azure SQL database using MFA

386 views Asked by At

I have an Azure SQL Database and would like to give customers access to it in a C# program I am writing. I'm using Microsoft.Data.SqlClient and Authentication=Active Directory Interactive in the connection string.

I've created a guest user and set up a conditional access policy.

I've got Email OTP and SMS active for the user. It works... when my program opens the connection it first sends an Email OTP. Then if successful it sends an SMS text code.

It's a bit cumbersome for the user. What I would like is for them to be able to enter a password and then either the OTP or SMS. Is there any way to do this?

Also, every time the program runs it requires passing the MFA. Is there any way to make it persist for a timespan? It seems to ignore the timespan I have set in the Entra admin portal.

I've looked in the Entra admin portal but can't find a way to enter a password for a guest user.

In preview is the new "Microsoft Entra ID for Customers", but there doesn't seem to be a way to tie that to a SQL Database resource.

0

There are 0 answers