How do I force Azure AD MFA prompt for WInForms application logins?

Viewed 46

I have a .Net Winforms desktop application. I'm authenticating users through Azure Active Directory. Individual AD users have MFA enabled.

I'm using the following code snippet for authenication within my code:

var builder = PublicClientApplicationBuilder
             .Create(AzureADAuthentication.ClientId)
             .WithAuthority(AzureADAuthentication.Instance + AzureADAuthentication.Tenant)
             .WithDefaultRedirectUri();

builder.WithWindowsBroker();
PublicClientApp = builder.Build();

authResult = await PublicClientApp
                  .AcquireTokenInteractive((IEnumerable<string>) scopes)
                  .WithParentActivityOrWindow(parentForm.Handle)
                  .WithPrompt(Prompt.NoPrompt)
                  .WithLoginHint(loginHint)
                  .ExecuteAsync();

Is there a way that I can enforce MFA login, either once a day or perhaps even every login? There seems to be some default period/interval for which a login will remain valid. So I if login/shut own the application successive times, I'm not getting MFA prompts.

Is there a way to force MFA during App login?

0 Answers
Related