Skip to content

Commit 1b706a7

Browse files
authored
Merge pull request #345 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents 99d2d8f + d1d0d5c commit 1b706a7

File tree

2 files changed

+64
-2
lines changed

2 files changed

+64
-2
lines changed

Modules/CIPPCore/Public/Compare-CIPPIntuneObject.ps1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ function Compare-CIPPIntuneObject {
257257
}
258258
}
259259
}
260-
Default {
260+
default {
261261
if ($settingInstance.simpleSettingValue?.value) {
262262
$label = if ($intuneObj?.displayName) {
263263
$intuneObj.displayName
@@ -337,6 +337,9 @@ function Compare-CIPPIntuneObject {
337337
} else {
338338
$child.choiceSettingValue.value
339339
}
340+
if (!$childValue -and $child.simpleSettingValue.value) {
341+
$childValue = $child.simpleSettingValue.value
342+
}
340343
}
341344

342345
# Add object to our temporary list
@@ -351,7 +354,7 @@ function Compare-CIPPIntuneObject {
351354
}
352355
}
353356
}
354-
Default {
357+
default {
355358
if ($settingInstance.simpleSettingValue?.value) {
356359
$label = if ($intuneObj?.displayName) {
357360
$intuneObj.displayName
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
function Invoke-CIPPStandardAuthMethodsPolicyMigration {
2+
<#
3+
.FUNCTIONALITY
4+
Internal
5+
.COMPONENT
6+
(APIName) AuthMethodsPolicyMigration
7+
.SYNOPSIS
8+
(Label) Complete Authentication Methods Policy Migration
9+
.DESCRIPTION
10+
(Helptext) Completes the migration of authentication methods policy to the new format
11+
(DocsDescription) Sets the authentication methods policy migration state to complete. This is required when migrating from legacy authentication policies to the new unified authentication methods policy.
12+
.NOTES
13+
CAT
14+
Entra (AAD) Standards
15+
TAG
16+
ADDEDCOMPONENT
17+
IMPACT
18+
Medium Impact
19+
ADDEDDATE
20+
2025-01-08
21+
POWERSHELLEQUIVALENT
22+
Update-MgBetaPolicyAuthenticationMethodPolicy
23+
RECOMMENDEDBY
24+
UPDATECOMMENTBLOCK
25+
Run the Tools\Update-StandardsComments.ps1 script to update this comment block
26+
.LINK
27+
https://docs.cipp.app/user-documentation/tenant/standards/list-standards
28+
#>
29+
30+
param($Tenant, $Settings)
31+
$CurrentInfo = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/policies/authenticationMethodsPolicy' -tenantid $Tenant
32+
33+
if ($Settings.remediate -eq $true) {
34+
if ($CurrentInfo.policyMigrationState -eq 'migrationComplete') {
35+
Write-LogMessage -API 'Standards' -tenant $tenant -message 'Authentication methods policy migration is already complete.' -sev Info
36+
} else {
37+
try {
38+
New-GraphPOSTRequest -uri 'https://graph.microsoft.com/beta/policies/authenticationMethodsPolicy' -tenantid $Tenant -body '{"policyMigrationState": "migrationComplete"}' -type PATCH
39+
Write-LogMessage -API 'Standards' -tenant $tenant -message 'Authentication methods policy migration completed successfully.' -sev Info
40+
} catch {
41+
Write-LogMessage -API 'Standards' -tenant $tenant -message "Failed to complete authentication methods policy migration: $($_.Exception.Message)" -sev Error
42+
}
43+
}
44+
}
45+
46+
if ($Settings.alert -eq $true) {
47+
if ($CurrentInfo.policyMigrationState -ne 'migrationComplete') {
48+
Write-StandardsAlert -message 'Authentication methods policy migration is not complete. Please check if you have legacy SSPR settings or MFA settings set: https://learn.microsoft.com/en-us/entra/identity/authentication/how-to-authentication-methods-manage' -object $CurrentInfo -tenant $tenant -standardName 'AuthMethodsPolicyMigration' -standardId $Settings.standardId
49+
Write-LogMessage -API 'Standards' -tenant $tenant -message 'Authentication methods policy migration is not complete' -sev Alert
50+
}
51+
}
52+
53+
if ($Settings.report -eq $true) {
54+
$migrationComplete = $CurrentInfo.policyMigrationState -eq 'migrationComplete'
55+
Set-CIPPStandardsCompareField -FieldName 'standards.AuthMethodsPolicyMigration' -FieldValue $migrationComplete -TenantFilter $tenant
56+
Add-CIPPBPAField -FieldName 'AuthMethodsPolicyMigration' -FieldValue $migrationComplete -StoreAs bool -Tenant $tenant
57+
}
58+
59+
}

0 commit comments

Comments
 (0)