- Go to Azure AD portal
- Create a new user with a temporary password
- Use the username and password to sign into https://myaccount.microsoft.com in an incognito window
- Chnage user's password to a secure one
- In My Account portal go to Security info and
Add sign-in methodthen selectAuthenticator app - Select
I want to use a different authenticator appand click next - When presented with a QR code, click
Can't scan image?button and copy theSecret key - Generate the code using the code below
import { authenticator } from 'otplib';
console.log(authenticator.generate('<SECRET>'))