|
1 | | -Function Push-ExecOnboardTenantQueue { |
| 1 | +function Push-ExecOnboardTenantQueue { |
2 | 2 | <# |
3 | 3 | .FUNCTIONALITY |
4 | 4 | Entrypoint |
@@ -354,22 +354,29 @@ Function Push-ExecOnboardTenantQueue { |
354 | 354 | if ($OnboardingSteps.Step4.Status -eq 'succeeded') { |
355 | 355 | if ($Item.StandardsExcludeAllTenants -eq $true) { |
356 | 356 | $AddExclusionObj = [PSCustomObject]@{ |
357 | | - label = $Tenant.defaultDomainName |
| 357 | + label = '{0} ({1})' -f $Tenant.displayName, $Tenant.defaultDomainName |
358 | 358 | value = $Tenant.defaultDomainName |
359 | | - addedFields = @{} |
| 359 | + addedFields = @{ |
| 360 | + customerId = $Tenant.customerId |
| 361 | + defaultDomainName = $Tenant.defaultDomainName |
| 362 | + } |
360 | 363 | } |
361 | 364 | $Table = Get-CippTable -tablename 'templates' |
362 | 365 | $ExistingTemplates = Get-CippazDataTableEntity @Table -Filter "PartitionKey eq 'StandardsTemplateV2'" | Where-Object { $_.JSON -match 'AllTenants' } |
363 | | - foreach ($AllTenantesTemplate in $ExistingTemplates) { |
| 366 | + foreach ($AllTenantsTemplate in $ExistingTemplates) { |
364 | 367 | $object = $AllTenantesTemplate.JSON | ConvertFrom-Json |
365 | | - $NewExcludedTenants = $object.excludedTenants + $AddExclusionObj |
| 368 | + $NewExcludedTenants = [system.collections.generic.list[object]]::new() |
| 369 | + foreach ($Tenant in $object.excludedTenants) { |
| 370 | + $NewExcludedTenants.Add($Tenant) |
| 371 | + } |
| 372 | + $NewExcludedTenants.Add($AddExclusionObj) |
366 | 373 | $object.excludedTenants = $NewExcludedTenants |
367 | 374 | $JSON = ConvertTo-Json -InputObject $object -Compress -Depth 10 |
368 | 375 | $Table.Force = $true |
369 | 376 | Add-CIPPAzDataTableEntity @Table -Entity @{ |
370 | 377 | JSON = "$JSON" |
371 | | - RowKey = $AllTenantesTemplate.RowKey |
372 | | - GUID = $AllTenantesTemplate.GUID |
| 378 | + RowKey = $AllTenantsTemplate.RowKey |
| 379 | + GUID = $AllTenantsTemplate.GUID |
373 | 380 | PartitionKey = 'StandardsTemplateV2' |
374 | 381 | } |
375 | 382 | } |
|
0 commit comments