Connect to Office 365 services with multifactor authentication (MFA) and PowerShell
Multifactor authentication (MFA) is an Office 365 security best practice, especially for administrator accounts. The Office 365 portal enforces MFA for accounts that have it enabled, but administrators also use PowerShell to manage Office 365.
To connect to Office 365 services with MFA and PowerShell:
- For the Azure Active Directory (AD) tenant with the Windows Azure Active Directory Module (cmdlets have “Msol” in their name), see Connect to Office 365 PowerShell.
- For the Azure AD tenant with the Azure Active Directory V2 module (cmdlets have “AzureAD” in their name), see Connect with the Azure Active Directory V2 PowerShell module.
- For Exchange Online, see Connect to Exchange Online PowerShell using multi-factor authentication.
- For SharePoint Online, see Connect to SharePoint Online PowerShell.
- For Skype for Business Online, see Connect to Skype for Business Online.
- For the Security & Compliance Center, see Connect to Office 365 Security & Compliance Center PowerShell using multi-factor authentication.
For each of these connections, you are prompted with a dialog box to collect the account user name and password and then an additional dialog box for MFA information, such as a verification code. Here is an example for SharePoint Online:
To experiment with MFA in an Office 365 trial subscription, see Multi-factor authentication for your Office 365 dev/test environment.
To join the CAAB, become a member of the CAAB space in the Microsoft Tech Community and send a quick email to CAAB@microsoft.com to introduce yourself. Please feel free to include any information about your experience in creating cloud-based solutions with Microsoft products or areas of interest. Join now and add your voice to the cloud adoption discussion that is happening across Microsoft and the industry.
Comments
- Anonymous
April 27, 2017
AIP PowerShell also supports MFA :) The Security and Compliance Center is the last one left, of the ones I use at least.- Anonymous
June 07, 2017
The comment has been removed
- Anonymous
- Anonymous
May 06, 2017
Great post. I was checking continuously this blog and I am impressed!Very helpful information particularly the last part :) I care for such information much. I was seeking this particular information for a very long time.Thank you and good luck. - Anonymous
May 17, 2017
Feel free to use my script - Office 365 Connection Script with MFA - Multi-Factor Authentication- https://gallery.technet.microsoft.com/Office-365-Connection-47e03052 -The script will connect to the following services with MFA (Multi-Factor Authentication) enabled- - Exchange Online- SharePoint Online- Skype for Business Online- Azure AD v1.0- Azure AD v2.0- Azure Resource Manager - Azure Rights Manager- Exchange Online Protection- Anonymous
July 26, 2017
Thank you very much Terry! It's really helpful. - Anonymous
October 12, 2017
how we can relate the MFA module in the existing scripts
- Anonymous