none
Exchange Online MFA code for C# batch jobs RRS feed

  • Question

  • We have been using a batch job using Exchange Web Services to send emails to users. Recently, our organisation has implemented MFA and mandated it for the account we have been using for the application. So, the job could not authenticate and send the emails. The security team is very strict about security of the account.

    1. Is there white listing the IP in Office 365 to accept authentication?

    2. Is app passwords help in this case?

    3. Is there any sample C# code for authenticate a EWS based background job?

    Appreciate any of your help.

    Friday, March 27, 2020 1:25 PM

All replies

  • Hi,

    Welcome to the Exchange Server forum. This forum is for questions and feedback related to Exchange server. Since your question is more related to Exchange development, I'll move it to a more appropriate forum: Exchange Server Development.

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    Regards,

    Kyle Xu


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Monday, March 30, 2020 2:12 AM
  • An App password is the most straight forward way of solving your problem they take about a minute to create and won't require any code changes. However App Password only work with Basic Authentication which is going to be disabled in October https://support.microsoft.com/en-au/help/4521831/exchange-online-deprecating-basic-auth so maybe a short term solution.

    Managed Identities in Azure is one solution you might want to look at https://docs.microsoft.com/en-us/azure/logic-apps/create-managed-service-identity and also consider moving your code away from using EWS into the Graph which will allow you to reduce the number of permissions your application needs if all its doing is sending email.  

    Cheers
    Glen


    Wednesday, April 1, 2020 11:27 PM