|
| 1 | +function Invoke-CIPPStandardDisableQRCodePin { |
| 2 | + <# |
| 3 | + .FUNCTIONALITY |
| 4 | + Internal |
| 5 | + .COMPONENT |
| 6 | + (APIName) DisableQRCodePin |
| 7 | + .SYNOPSIS |
| 8 | + (Label) Disables QR Code Pin as an MFA method |
| 9 | + .DESCRIPTION |
| 10 | + (Helptext) This blocks users from using QR Code Pin as an MFA method. If a user only has QR Code Pin as a MFA method, they will be unable to log in. |
| 11 | + (DocsDescription) Disables QR Code Pin as an MFA method for the tenant. If a user only has QR Code Pin as a MFA method, they will be unable to sign in. |
| 12 | + .NOTES |
| 13 | + CAT |
| 14 | + Entra (AAD) Standards |
| 15 | + TAG |
| 16 | + "highimpact" |
| 17 | + ADDEDCOMPONENT |
| 18 | + IMPACT |
| 19 | + High Impact |
| 20 | + POWERSHELLEQUIVALENT |
| 21 | + Update-MgBetaPolicyAuthenticationMethodPolicyAuthenticationMethodConfiguration |
| 22 | + RECOMMENDEDBY |
| 23 | + UPDATECOMMENTBLOCK |
| 24 | + Run the Tools\Update-StandardsComments.ps1 script to update this comment block |
| 25 | + .LINK |
| 26 | + https://docs.cipp.app/user-documentation/tenant/standards/list-standards/entra-aad-standards#high-impact |
| 27 | + #> |
| 28 | + |
| 29 | + param($Tenant, $Settings) |
| 30 | + |
| 31 | + $CurrentState = New-GraphGetRequest -Uri 'https://graph.microsoft.com/beta/policies/authenticationmethodspolicy/authenticationMethodConfigurations/QRCodePin' -tenantid $Tenant |
| 32 | + $StateIsCorrect = ($CurrentState.state -eq 'disabled') |
| 33 | + |
| 34 | + If ($Settings.remediate -eq $true) { |
| 35 | + if ($StateIsCorrect -eq $true) { |
| 36 | + Write-LogMessage -API 'Standards' -tenant $tenant -message 'QR Code Pin authentication method is already disabled.' -sev Info |
| 37 | + } else { |
| 38 | + try { |
| 39 | + Set-CIPPAuthenticationPolicy -Tenant $tenant -APIName 'Standards' -AuthenticationMethodId 'QRCodePin' -Enabled $false |
| 40 | + } catch { |
| 41 | + } |
| 42 | + } |
| 43 | + } |
| 44 | + |
| 45 | + if ($Settings.alert -eq $true) { |
| 46 | + if ($StateIsCorrect -eq $true) { |
| 47 | + Write-LogMessage -API 'Standards' -tenant $tenant -message 'QR Code Pin authentication method is not enabled' -sev Info |
| 48 | + } else { |
| 49 | + Write-LogMessage -API 'Standards' -tenant $tenant -message 'QR Code Pin authentication method is enabled' -sev Alert |
| 50 | + } |
| 51 | + } |
| 52 | + |
| 53 | + if ($Settings.report -eq $true) { |
| 54 | + Add-CIPPBPAField -FieldName 'DisableQRCodePin' -FieldValue $StateIsCorrect -StoreAs bool -Tenant $tenant |
| 55 | + } |
| 56 | +} |
0 commit comments