Skip to content

Commit 635302f

Browse files
committed
only create tenant mapping if the TenantId is actually set
1 parent 30f151b commit 635302f

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

Modules/CippExtensions/Public/Halo/Set-HaloMapping.ps1

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ function Set-HaloMapping {
99
Remove-AzDataTableEntity -Force @CIPPMapping -Entity $_
1010
}
1111
foreach ($Mapping in $Request.Body) {
12-
$AddObject = @{
13-
PartitionKey = 'HaloMapping'
14-
RowKey = "$($mapping.TenantId)"
15-
IntegrationId = "$($mapping.IntegrationId)"
16-
IntegrationName = "$($mapping.IntegrationName)"
12+
if ($Mapping.TenantId) {
13+
$AddObject = @{
14+
PartitionKey = 'HaloMapping'
15+
RowKey = "$($mapping.TenantId)"
16+
IntegrationId = "$($mapping.IntegrationId)"
17+
IntegrationName = "$($mapping.IntegrationName)"
18+
}
1719
}
1820

1921
Add-CIPPAzDataTableEntity @CIPPMapping -Entity $AddObject -Force
20-
2122
Write-LogMessage -API $APINAME -headers $Request.Headers -message "Added mapping for $($mapping.name)." -Sev 'Info'
2223
}
2324
$Result = [pscustomobject]@{'Results' = 'Successfully edited mapping table.' }

Modules/CippExtensions/Public/NinjaOne/Set-NinjaOneOrgMapping.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ function Set-NinjaOneOrgMapping {
1010
Remove-AzDataTableEntity -Force @CIPPMapping -Entity $_
1111
}
1212
foreach ($Mapping in $Request.Body) {
13-
$AddObject = @{
14-
PartitionKey = 'NinjaOneMapping'
15-
RowKey = "$($mapping.TenantId)"
16-
IntegrationId = "$($mapping.IntegrationId)"
17-
IntegrationName = "$($mapping.IntegrationName)"
13+
if ($Mapping.TenantId) {
14+
$AddObject = @{
15+
PartitionKey = 'NinjaOneMapping'
16+
RowKey = "$($mapping.TenantId)"
17+
IntegrationId = "$($mapping.IntegrationId)"
18+
IntegrationName = "$($mapping.IntegrationName)"
19+
}
1820
}
19-
2021
Add-CIPPAzDataTableEntity @CIPPMapping -Entity $AddObject -Force
21-
2222
Write-LogMessage -API $APINAME -headers $Request.Headers -message "Added mapping for $($mapping.name)." -Sev 'Info'
2323
}
2424
$Result = [pscustomobject]@{'Results' = 'Successfully edited mapping table.' }

0 commit comments

Comments
 (0)