<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mfa status script Archives - the Sysadmin Channel</title>
	<atom:link href="https://thesysadminchannel.com/tag/mfa-status-script/feed/" rel="self" type="application/rss+xml" />
	<link>https://thesysadminchannel.com/tag/mfa-status-script/</link>
	<description>Documenting My Life as a System Administrator</description>
	<lastBuildDate>Sat, 07 May 2022 07:16:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>
<site xmlns="com-wordpress:feed-additions:1">144174110</site>	<item>
		<title>Get Per-User MFA Status using PowerShell</title>
		<link>https://thesysadminchannel.com/get-per-user-mfa-status-using-powershell/</link>
					<comments>https://thesysadminchannel.com/get-per-user-mfa-status-using-powershell/#comments</comments>
		
		<dc:creator><![CDATA[Paul Contreras]]></dc:creator>
		<pubDate>Sat, 07 May 2022 07:01:01 +0000</pubDate>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[mfa status script]]></category>
		<category><![CDATA[per-user mfa status]]></category>
		<guid isPermaLink="false">https://thesysadminchannel.com/?p=4169</guid>

					<description><![CDATA[<p>There are a ton of scripts out there that show you if the user has MFA enabled by checking their authentication methods, something very similar to this Get MFA Methods using Graph API script I wrote a while back. However,&#8230; <a href="https://thesysadminchannel.com/get-per-user-mfa-status-using-powershell/" class="more-link">Continue Reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://thesysadminchannel.com/get-per-user-mfa-status-using-powershell/">Get Per-User MFA Status using PowerShell</a> appeared first on <a href="https://thesysadminchannel.com">the Sysadmin Channel</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>There are a ton of scripts out there that show you if the user has MFA enabled by checking their authentication methods, something very similar to this <a href="https://thesysadminchannel.com/get-mfa-methods-using-msgraph-api-and-powershell-sdk/" rel="noopener" target="_blank">Get MFA Methods using Graph API</a> script I wrote a while back.  However, I haven&#8217;t really seen a script to show me what their per-user MFA status is.<br />
&nbsp;</p>
<p>Well today, we&#8217;re going to do just that.  I understand this is the legacy method for setting multi-factor authentication on user accounts, however, there&#8217;s a probable chance that you might have forgotten to disable it when you eventually moved on to setting <a href="https://thesysadminchannel.com/deploy-mfa-using-azure-ad-conditional-access/" rel="noopener" target="_blank">MFA using conditional access policies</a>.  I say that because this was the case for me not too long ago.  </p>
<div id="tableofcontents">
<h2>Table Of Contents</h2>
<ul>
<li><a href="#requirements">Requirements</a></li>
<li><a href="#perusermfaportal">Get Per-User MFA Status using Office 365 Portal</a></li>
<li><a href="#perusermfapowershell">Get Per-User MFA Status using PowerShell</a></li>
<ul>
<li><a href="#parameters">Script Parameters</a></li>
<li><a href="#examples">Examples and Usage</a></li>
</ul>
<li><a href="#conclusion">Conclusion</a></li>
</ul>
</div>
<p>&nbsp;</p>
<div id="requirements" style="scroll-margin-top: 15px;"></div>
<h2>Requirements</h2>
<p>In order to get started with checking per-user MFA status, we&#8217;re going to need a few things in place to make sure we get a successful output.  Let&#8217;s list them out here.<br />
&nbsp;</p>
<ul>
<li>MSOnline (MSOL) PowerShell Module</li>
<li>Global Administrator Role</li>
</ul>
<div id="perusermfaportal" style="scroll-margin-top: 15px;"></div>
<h2>Get Per-User MFA Status using Office 365 Portal</h2>
<p>Before we get into the Powershell method, I wanted to quickly go over the method using the legacy Office 365 Portal.  In order to check this, you will need to be a Global Administrator.<br />
&nbsp;</p>
<p>In Azure AD:</p>
<ul>
<li>Navigate to <strong>Users</strong> -> <strong>Per-user MFA</strong></li>
<li>Using the drop down for <strong>Multi-Factor Auth status</strong>: Choose <strong>Enabled</strong> or <strong>Enforced</strong></li>
</ul>
<p><a href="https://thesysadminchannel.com/wp-content/uploads/2022/05/Get-Per-User-MFA-Status-using-Office-365-Portal.png" target="_blank" rel="noopener"><img fetchpriority="high" decoding="async" src="https://thesysadminchannel.com/wp-content/uploads/2022/05/Get-Per-User-MFA-Status-using-Office-365-Portal.png" alt="Get Per-User MFA Status using Office 365 Portal" width="946" height="390" class="aligncenter size-full wp-image-4180" srcset="https://thesysadminchannel.com/wp-content/uploads/2022/05/Get-Per-User-MFA-Status-using-Office-365-Portal.png?v=1651881481 946w, https://thesysadminchannel.com/wp-content/uploads/2022/05/Get-Per-User-MFA-Status-using-Office-365-Portal-768x317.png?v=1651881481 768w" sizes="(max-width: 946px) 100vw, 946px" /></a><br />
&nbsp;</p>
<p>Using this method, you have the option to quickly see their status and if you&#8217;re up to it, you can disable them right there.</p>
<div id="blockquote1">
<strong>Note</strong>: Before you disable per-user MFA, it is highly recommended to convert them to Conditional Access based MFA using this <a href="https://docs.microsoft.com/en-us/azure/active-directory/authentication/howto-mfa-userstates#convert-users-from-per-user-mfa-to-conditional-access-based-mfa" rel="noopener" target="_blank">script from MS Docs</a>
</div>
<div id="perusermfapowershell" style="scroll-margin-top: 15px;"></div>
<h2>Get Per-User MFA Status using PowerShell</h2>
<p>Now that we know how to check in the portal to view the per-user mfa status, let&#8217;s take look at how to do this within PowerShell.  This requires you to be connected to the MSOnline using Connect-MSolService so let&#8217;s take a look now.</p>
<pre class="brush: powershell; title: ; notranslate">

Function Get-PerUserMFAStatus {
&lt;#
.SYNOPSIS
    Get Per-User MFA Status using MSOnline Powershell Module

.NOTES
    Name: Get-PerUserMFAStatus
    Author: theSysadminChannel
    Version: 1.0
    DateCreated: 2021-Feb-3

.LINK
    https://thesysadminchannel.com/get-per-user-mfa-status-using-powershell -
#&gt;

    [CmdletBinding(DefaultParameterSetName='All')]
    param(
        [Parameter(
            Mandatory = $false,
            ParameterSetName = 'UPN',
            Position = 0
        )]
        [string[]]  $UserPrincipalName,


        [Parameter(
            Mandatory = $false,
            ParameterSetName = 'All'
        )]
        [switch]    $All

    )

    BEGIN {
        if (-not (Get-MsolDomain -ErrorAction SilentlyContinue)) {
            Write-Error &quot;You must connect to the MSolService to continue&quot; -ErrorAction Stop
        }
    }

    PROCESS {
        if ($PSBoundParameters.ContainsKey('UserPrincipalName')) {
            $MsolUserList = foreach ($MsolUser in $UserPrincipalName) {
                try {
                    Get-MsolUser -UserPrincipalName $MsolUser -ErrorAction Stop
                    
                } catch {
                    Write-Error $_.Exception.Message

                }
            }
        } else {
            $MsolUserList = Get-MsolUser -All -ErrorAction Stop | Where-Object {$_.UserType -ne 'Guest' -and $_.DisplayName -notmatch 'On-Premises Directory Synchronization'}
        }

        #Now that we have our UserList, lets check the per-user mfa status
        foreach ($User in $MsolUserList) {
            if ($User.StrongAuthenticationRequirements) {
                $PerUserMFAState = $User.StrongAuthenticationRequirements.State

              } else {
                $PerUserMFAState = 'Disabled'

            }

            $MethodType = $User.StrongAuthenticationMethods | Where-Object {$_.IsDefault -eq $true} | select -ExpandProperty MethodType
            
            if ($MethodType) {
                switch ($MethodType) {
                    'OneWaySMS'            {$DefaultMethodType = 'SMS Text Message'  }
                    'TwoWayVoiceMobile'    {$DefaultMethodType = 'Call to Phone'     }
                    'PhoneAppOTP'          {$DefaultMethodType = 'TOTP'              }
                    'PhoneAppNotification' {$DefaultMethodType = 'Authenticator App' }
                }
              } else {
                $DefaultMethodType = 'Not Enabled'
            }
    
            [PSCustomObject]@{
                UserPrincipalName    = $User.UserPrincipalName
                DisplayName          = $User.DisplayName
                PerUserMFAState      = $PerUserMFAState
                DefaultMethodType    = $DefaultMethodType

            }

            $MethodType        = $null
        }

    }

    END {}
}

</pre>
<div id="parameters" style="scroll-margin-top: 15px;"></div>
<h2>Script Parameters</h2>
<h3>    -UserPrincipalName</h3>
<p>DataType: string/array<br />
Description: Specify the UserPrincipalName of the per-user MFA status you would like to see.  Multiple UPNs separated by a comma are acceptable.<br />
&nbsp;</p>
<div id="examples" style="scroll-margin-top: 15px;"></div>
<h3>Example 1 &#8211; Specifying UserPrincipalNames separated by a comma</h3>
<pre class="brush: powershell; gutter: false; title: ; notranslate">
PS C:\&gt; Get-PerUserMFAStatus -UserPrincipalName aaduser3@thesysadminchannel.com, aaduser4@thesysadminchannel.com, `
astark@thesysadminchannel.com, jsnow@thesysadminchannel.com
</pre>
<p><a href="https://thesysadminchannel.com/wp-content/uploads/2022/05/01-Get-Per-User-MFA-Status-using-Powershell.png" target="_blank" rel="noopener"><img decoding="async" src="https://thesysadminchannel.com/wp-content/uploads/2022/05/01-Get-Per-User-MFA-Status-using-Powershell.png" alt="Get Per-User MFA Status using Powershell" width="1053" height="314" class="aligncenter size-full wp-image-4188" srcset="https://thesysadminchannel.com/wp-content/uploads/2022/05/01-Get-Per-User-MFA-Status-using-Powershell.png?v=1651890614 1053w, https://thesysadminchannel.com/wp-content/uploads/2022/05/01-Get-Per-User-MFA-Status-using-Powershell-1024x305.png?v=1651890614 1024w, https://thesysadminchannel.com/wp-content/uploads/2022/05/01-Get-Per-User-MFA-Status-using-Powershell-768x229.png?v=1651890614 768w" sizes="(max-width: 1053px) 100vw, 1053px" /></a><br />
&nbsp;</p>
<h3>Example 2 &#8211; Getting all user&#8217;s status in the tenant</h3>
<pre class="brush: powershell; gutter: false; title: ; notranslate">
PS C:\&gt; Get-PerUserMFAStatus -All
</pre>
<p><a href="https://thesysadminchannel.com/wp-content/uploads/2022/05/02-Get-Per-User-MFA-Status-using-Powershell.png" target="_blank" rel="noopener"><img decoding="async" src="https://thesysadminchannel.com/wp-content/uploads/2022/05/02-Get-Per-User-MFA-Status-using-Powershell.png" alt="Get Per-User MFA Status using Powershell" width="860" height="350" class="aligncenter size-full wp-image-4190" srcset="https://thesysadminchannel.com/wp-content/uploads/2022/05/02-Get-Per-User-MFA-Status-using-Powershell.png?v=1651891330 860w, https://thesysadminchannel.com/wp-content/uploads/2022/05/02-Get-Per-User-MFA-Status-using-Powershell-768x313.png?v=1651891330 768w" sizes="(max-width: 860px) 100vw, 860px" /></a></p>
<p>&nbsp;</p>
<div id="conclusion" style="scroll-margin-top: 15px;"></div>
<h2>Conclusion</h2>
<p>As mentioned, the per-user mfa is not the recommended way to enable MFA for your users.  For that, we&#8217;ll want to either use conditional access (which require an Azure P1/P2 license). For those that don&#8217;t have this license in their tenant, you can use security defaults which enables MFA across the whole tenant.<br />
&nbsp;</p>
<p>Hopefully, you were able to find this script useful in finding which users still have the legacy MFA method enabled.</p>
<p>The post <a href="https://thesysadminchannel.com/get-per-user-mfa-status-using-powershell/">Get Per-User MFA Status using PowerShell</a> appeared first on <a href="https://thesysadminchannel.com">the Sysadmin Channel</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://thesysadminchannel.com/get-per-user-mfa-status-using-powershell/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4169</post-id>	</item>
	</channel>
</rss>
