Commit 4068be9
committed
fix: correct Intune policy matching in drift report to avoid null-name false match
Get-CIPPDrift compared raw .displayName/.name properties across four OR
clauses to detect whether a tenant's Intune policy was already covered by
a template. Most Intune policy types (compliance policies, device
configurations, app protection policies, group policy configurations,
Windows Update profiles) have no .name property at all - only
displayName. Since PowerShell's $null -eq $null evaluates to $True, the
.name -eq .name clause falsely matched as soon as any configured
template lacked a .name property, marking almost every tenant-only
Intune policy as already templated and suppressing its deviation.
Conditional Access matching was unaffected because it only ever compares
.displayName, with no .name fallback/collision risk - matching the
reported symptom where CA drift worked but Intune drift did not.
Fix: compare the already-computed, normalized effective names
($TemplatePolicyName/$TenantPolicyName, which fall back from
displayName to name) instead of the raw properties, and require both
sides to be non-empty before treating them as a match.
Fixes KelvinTegelaar/CIPP#63471 parent 98f0778 commit 4068be9
1 file changed
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
386 | 390 | | |
387 | 391 | | |
388 | 392 | | |
| |||
0 commit comments