Skip to content

Commit 282623e

Browse files
committed
New standard for QR code auth method disablement
1 parent 7ad53d3 commit 282623e

2 files changed

Lines changed: 58 additions & 2 deletions

File tree

Modules/CIPPCore/Public/Set-CIPPAuthenticationPolicy.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ function Set-CIPPAuthenticationPolicy {
109109
# QR code
110110
'QRCodePin' {
111111
if ($State -eq 'enabled') {
112-
$CurrentInfo.pinLength = $QRCodePinLength
113-
$CurrentInfo.standardQRCodeLifetimeInDays = $QRCodeLifetimeInDays
112+
Write-LogMessage -headers $Headers -API $APIName -tenant $Tenant -message "Setting $AuthenticationMethodId to enabled is not allowed" -sev Error
113+
throw "Setting $AuthenticationMethodId to enabled is not allowed"
114114
}
115115
}
116116
Default {
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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

Comments
 (0)