Skip to content

Commit

Permalink
Small change to make it easier to add exclusions in the future
Browse files Browse the repository at this point in the history
  • Loading branch information
kris6673 committed Oct 23, 2024
1 parent f1b2680 commit e8e07cf
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,24 @@ function Push-DomainAnalyserTenant {
return
} else {
try {
$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) }
# Remove domains that are not wanted, and used for cloud signature services
$ExclusionDomains = @(
'*.microsoftonline.com'
'*.exclaimer.cloud'
'*.excl.cloud'
'*.codetwo.online'
'*.call2teams.com'
'*signature365.net'
)
$Domains = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/domains' -tenantid $Tenant.customerId | Where-Object { $_.isVerified -eq $true } | ForEach-Object {
$Domain = $_
foreach ($ExclusionDomain in $ExclusionDomains) {
if ($Domain.id -like $ExclusionDomain) {
$Domain = $null
}
}
$Domain
} | Where-Object { $_ -ne $null }

$TenantDomains = foreach ($d in $Domains) {
[PSCustomObject]@{
Expand Down

0 comments on commit e8e07cf

Please sign in to comment.