Skip to content

Commit 2a07d7f

Browse files
Merge pull request #1463 from Zacgoose/huntress-app-alert
Huntress Alert: Make it possible to ignore disabled apps, backwards compatible
2 parents f1f6860 + 4ae5cd9 commit 2a07d7f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Modules/CIPPCore/Public/Alerts/Get-CIPPAlertHuntressRogueApps.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,20 @@ function Get-CIPPAlertHuntressRogueApps {
1414
[Parameter(Mandatory = $false)]
1515
[Alias('input')]
1616
$InputValue,
17-
$TenantFilter
17+
$TenantFilter,
18+
[Parameter(Mandatory = $false)]
19+
[Alias('ignoreDisabledApps')]
20+
[bool]$IgnoreDisabledApps = $false
1821
)
1922

2023
try {
2124
$RogueApps = Invoke-RestMethod -Uri 'https://raw.githubusercontent.com/huntresslabs/rogueapps/main/public/rogueapps.json'
2225
$RogueAppFilter = $RogueApps.appId -join "','"
2326
$ServicePrincipals = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/servicePrincipals?`$filter=appId in ('$RogueAppFilter')" -tenantid $TenantFilter
27+
# If IgnoreDisabledApps is true, filter out disabled service principals
28+
if ($IgnoreDisabledApps) {
29+
$ServicePrincipals = $ServicePrincipals | Where-Object { $_.accountEnabled -eq $true }
30+
}
2431

2532
if (($ServicePrincipals | Measure-Object).Count -gt 0) {
2633
$AlertData = foreach ($ServicePrincipal in $ServicePrincipals) {

0 commit comments

Comments
 (0)