To setup two-factor authentication for Microsoft office 365, you will need to follow the below steps:
Sign in to Office 365 with your work or school account with your password like you normally do.
After you choose Sign in, you'll see this page:
Select your authentication method and then follow the prompts on the page. For Example, here we add a UK Mobile number
You will receive an app password that you can use with your email applications. Choose the copy icon to copy the password to your clipboard. You won't need to memorize this password
Once you complete the instructions to specify how you want to receive your verification code, the next time you sign in to Office 365, you'll be prompted to enter the code that is sent to you by text message, phone call, etc. If you need a new code, you can refresh the page by pressing F5.