You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$GDAPRelationships=New-GraphGetRequest-uri "https://graph.microsoft.com/beta/tenantRelationships/delegatedAdminRelationships?`$filter=status eq 'active' and not startsWith(displayName,'MLT_')$RelationshipFilter&`$select=customer,autoExtendDuration,endDateTime&`$top=300"-NoAuthCheck:$true
@@ -95,7 +94,11 @@ function Get-Tenants {
95
94
# Write-Host "Processing $($_.Name), $($_.displayName) to add to tenant list."
96
95
$ExistingTenantInfo=Get-CIPPAzDataTableEntity@TenantsTable-Filter "PartitionKey eq 'Tenants' and RowKey eq '$($_.Name)'"
if ($ExistingTenantInfo-and$ExistingTenantInfo.RequiresRefresh-eq$false-and$ExistingTenantInfo.displayName-eq$LatestRelationship.displayName) {
110
+
if ($ExistingTenantInfo-and$ExistingTenantInfo.RequiresRefresh-eq$false-and($ExistingTenantInfo.displayName-eq$LatestRelationship.displayName-or$ExistingTenantInfo.displayName-eq$Alias)) {
108
111
Write-Host'Existing tenant found. We already have it cached, skipping.'
112
+
113
+
$DisplayNameUpdated=$false
114
+
if (![string]::IsNullOrEmpty($Alias)) {
115
+
if ($Alias-ne$ExistingTenantInfo.displayName) {
116
+
Write-Host"Alias found for $($_.Name)."
117
+
$ExistingTenantInfo.displayName=$Alias
118
+
$DisplayNameUpdated=$true
119
+
}
120
+
} else {
121
+
if ($LatestRelationship.displayName-ne$ExistingTenantInfo.displayName) {
122
+
Write-Host'Display name changed from relationship, updating.'
0 commit comments