Skip to content

Commit 7e89ee6

Browse files
committed
Update Get-Tenants.ps1
1 parent 10e7b1b commit 7e89ee6

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

Modules/CIPPCore/Public/GraphHelper/Get-Tenants.ps1

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ function Get-Tenants {
107107
Add-CIPPAzDataTableEntity @TenantsTable -Entity $ExistingTenantInfo -Force | Out-Null
108108
}
109109

110-
$LatestRelationship = $_.Group | Sort-Object -Property relationshipEnd | Select-Object -Last 1
111-
112110
if ($ExistingTenantInfo -and $ExistingTenantInfo.RequiresRefresh -eq $false -and ($ExistingTenantInfo.displayName -eq $LatestRelationship.displayName -or $ExistingTenantInfo.displayName -eq $Alias)) {
113111
Write-Host 'Existing tenant found. We already have it cached, skipping.'
114112

@@ -135,7 +133,7 @@ function Get-Tenants {
135133
$ExistingTenantInfo
136134
return
137135
}
138-
136+
$LatestRelationship = $_.Group | Sort-Object -Property relationshipEnd | Select-Object -Last 1
139137
$AutoExtend = ($_.Group | Where-Object { $_.autoExtend -eq $true } | Measure-Object).Count -gt 0
140138
if (!$SkipDomains.IsPresent) {
141139
try {

0 commit comments

Comments
 (0)