Skip to content

Commit e8e07cf

Browse files
committed
Small change to make it easier to add exclusions in the future
1 parent f1b2680 commit e8e07cf

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Domain Analyser/Push-DomainAnalyserTenant.ps1

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,24 @@ function Push-DomainAnalyserTenant {
2020
return
2121
} else {
2222
try {
23-
$Domains = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/domains' -tenantid $Tenant.customerId | Where-Object { ($_.id -notlike '*.microsoftonline.com' -and $_.id -NotLike '*.exclaimer.cloud' -and $_.id -Notlike '*.excl.cloud' -and $_.id -NotLike '*.codetwo.online' -and $_.id -NotLike '*.call2teams.com' -and $_.id -notlike '*signature365.net' -and $_.isVerified) }
23+
# Remove domains that are not wanted, and used for cloud signature services
24+
$ExclusionDomains = @(
25+
'*.microsoftonline.com'
26+
'*.exclaimer.cloud'
27+
'*.excl.cloud'
28+
'*.codetwo.online'
29+
'*.call2teams.com'
30+
'*signature365.net'
31+
)
32+
$Domains = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/domains' -tenantid $Tenant.customerId | Where-Object { $_.isVerified -eq $true } | ForEach-Object {
33+
$Domain = $_
34+
foreach ($ExclusionDomain in $ExclusionDomains) {
35+
if ($Domain.id -like $ExclusionDomain) {
36+
$Domain = $null
37+
}
38+
}
39+
$Domain
40+
} | Where-Object { $_ -ne $null }
2441

2542
$TenantDomains = foreach ($d in $Domains) {
2643
[PSCustomObject]@{

0 commit comments

Comments
 (0)