Export Users DisplayName, UsageLocation, UserPrincipalName, MFA Status, StrongAuthInfo, DefaultAuthMethod from office 365 / Azure AD using PowerShell in CSV

You can export Office365 users DisplayName, UsageLocation, UserPrincipalName, MFA Status, StrongAuthInfo, DefaultAuthMethod using powershell. The exported data will be in a CSV File which will list these details. Default MFA Method is useful when you want to know who in your company is using which MFA method to authenticate to office365 services. For example, this data is also useful when you are planning to move the users from SMS based method to Phone App Method which is more secure. The PhoneAppNotification method means when users will get notification in MS Authenticator App and they tap on approve to confirm sign-in.

First you need to download / Install MSOnline powershell module on your system. You can download it from PowerShell Gallery | MSOnline location. Then use Connect-MsolService to connect to the Azure AD.

Powershell Code

Once you are successfully authenticated to Msolservice, run below command to export the data. You can modify the location where you want to export the data in the command.

Powershell Code
Get-MsolUser -all | select DisplayName,UsageLocation,UserPrincipalName,@{N=”MFA Status”; E={ if( $_.StrongAuthenticationRequirements.State -ne $null){ $_.StrongAuthenticationRequirements.State} else { “Disabled”}}},@{N=”StrongAuthInfo”; E={ if( $_.StrongAuthenticationMethods.MethodType -ne $null){ $_.StrongAuthenticationMethods.MethodType} else { “Disabled”}}},@{N=”DefaultAuthMethod”; E={if($_.StrongAuthenticationMethods.MethodType -ne $null){foreach($meth in $_.StrongAuthenticationMethods){if($meth.IsDefault -eq “True”) {$meth.MethodType}}} else { “Disabled”}}} | export-csv -Path “c:\Temp\UserAuthMethods.csv”

Subscribe to Stay Connected

Thank you for visiting TechPress 👍. When you subscribe to the blog, email notification ✉ will be sent to you when a new blog post is published. We do not spam or sell your email address. You can unsubscribe at any time.

Inline Feedbacks
View all comments