File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,17 +49,18 @@ function Add-CIPPDbItem {
4949 if ($null -eq $Item ) { continue }
5050 $ItemId = $Item.ExternalDirectoryObjectId ?? $Item.id ?? $Item.Identity ?? $Item.skuId ?? $Item.userPrincipalName ?? [guid ]::NewGuid().ToString()
5151 $RowKey = " $Type -$ItemId " -replace ' [/\\#?]' , ' _' -replace ' [\u0000-\u001F\u007F-\u009F]' , ' '
52- [void ]$NewRowKeys.Add ($RowKey )
53- $Batch.Add (@ {
54- PartitionKey = $TenantFilter
55- RowKey = $RowKey
56- Data = [string ]($Item | ConvertTo-Json - Depth 10 - Compress)
57- Type = $Type
58- })
59- if ($Batch.Count -ge 500 ) {
60- $null = Add-CIPPAzDataTableEntity @Table - Entity $Batch.ToArray () - Force
61- $TotalProcessed += $Batch.Count
62- $Batch.Clear ()
52+ if ($NewRowKeys.Add ($RowKey )) {
53+ $Batch.Add (@ {
54+ PartitionKey = $TenantFilter
55+ RowKey = $RowKey
56+ Data = [string ]($Item | ConvertTo-Json - Depth 10 - Compress)
57+ Type = $Type
58+ })
59+ if ($Batch.Count -ge 500 ) {
60+ $null = Add-CIPPAzDataTableEntity @Table - Entity $Batch.ToArray () - Force
61+ $TotalProcessed += $Batch.Count
62+ $Batch.Clear ()
63+ }
6364 }
6465 }
6566 }
You can’t perform that action at this time.
0 commit comments