Bypass MFA Using Jenkins to Run Automated Tests

Real World Problems

Bypass MFA Using Jenkins to Run Automated Tests

Multi-Factor Authentication is a major hurdle when automating workflows in D365. Here's a practical workaround using Jenkins, Playwright, and email notifications to handle MFA in scheduled automation runs — from anywhere in the world.

M
Madeshwaran Kotteswaran
••2 min read
Bypass MFA Using Jenkins to Run Automated Tests

MFA Bypass for Automated Scripts

As many of you know, Multi-Factor Authentication (MFA) is a big hurdle when trying to automate workflows related to D365. Here we found a workaround to overcome this bottleneck.

Tools Involved

  1. Jenkins — Free Style Project
  2. Playwright with TypeScript (any preferred framework)
  3. Cucumber with BDD
  4. Jenkins with Email Notification plug-in

Steps

Step 1

Create a simple BDD feature file that will key in the username and password for the MFA.

Step 2

Create a Free Style JOB in Jenkins with Username and Password as a parameter. Note: the Password field will be encrypted.

Step 3

Save your credentials in the Jenkins job — your credentials are encrypted and saved in the JOB.

Step 4

Create a simple job to read the MFA 2-digit code displayed in the browser.

Step 5

Integrate the 2-digit code with the email notification.

Outcome

When the job is scheduled to run at a specific time with the saved credentials from Jenkins:

  • The browser will show the 2-digit code and Playwright will capture the code
  • The code is passed to Jenkins email notification in the subject line of the email
  • An email is sent to the same email ID from the saved Jenkins job
  • The user receives the email and sign-in notification with the code in the subject line
  • If email notifications are enabled on mobile, you can see the 2-digit code and the notification at the same time
  • Enter the code and your automation script integrated with MFA will run from anywhere in the world — no need to sit in front of the machine

Summary

This solution is for teams stuck with MFA authentication who are unable to automate and execute in scheduled runs. By combining Jenkins' encrypted credential storage, Playwright's browser automation, and email notifications, you can fully automate MFA-protected workflows without manual intervention.

Explore Topics

#MFA#Jenkins#Playwright#Automation#D365
M

Written by

Madeshwaran Kotteswaran

Content creator and writer sharing insights and stories.

Madeshwaran Kotteswaran

Senior Test Automation Architect and AI-Driven Quality Engineering Specialist. 17+ years transforming how organisations build and ship software.

Navigation

Availability

Open

Get in touch

© 2026 Madeshwaran Kotteswaran. All rights reserved.

Privacy PolicyTerms of Use

Engineering Quality at Scale