Disable 2FA for an emailid

Lalitha Subramanian 25 Reputation points
2025-05-07T08:25:15.7966667+00:00

We have disabled 2FA for an email id XXXXXXXX. We use this email to send and receive emails via code. But sometimes authentication fails and mail not getting sent. On rerunning the script, the mail gets sent. We dont want this to happen in production. Is there a way to disable 2FA for a list of IP addresses which dont belong to a subnet range or any other range? I want to give a comma or semi colon separated list of IP addresses for whom the 2FA should be disabled.

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
24,688 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bandela Siri Chandana 2,970 Reputation points Microsoft External Staff Moderator
    2025-05-07T09:32:44.8066667+00:00

    Hi @Lalitha Subramanian
    I understand that you are trying to use email to send and receive emails via code, but authentication fails and mail not getting sent. Now you are trying a way to disable 2FA for a list of IP addresses which doesn't belong to a subnet range or any other range.

    You can try to achieve this by configuring a conditional access policy in Azure.

    You can define a conditional access policy by mentioning IP addresses range which should not prompt for MFA while accessing Azure resources. You can configure this in Named locations in Conditional access policy. Once you create Named locations you can use this Named location in the conditional access policy that you create.

    You can follow below article to configure CA policy with named locations using network IP ranges for MFA prompts.

    https://learn.microsoft.com/en-us/entra/identity/conditional-access/concept-assignment-network

    Let me know if you have any further questions.
    If this answers your query, do click Accept Answer and Yes.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.