Skip to content

Commit 4e02959

Browse files
committed
add partitionkey to table cleanup
1 parent f28a060 commit 4e02959

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Modules/CIPPCore/Public/Entrypoints/Timer Functions/Start-TableCleanup.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,31 @@ function Start-TableCleanup {
1717
@{
1818
DataTableProps = @{
1919
Context = (Get-CIPPTable -tablename 'AuditLogSearches').Context
20-
Filter = "Timestamp lt datetime'$((Get-Date).AddDays(-1).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ'))'"
20+
Filter = "PartitionKey eq 'Search' and Timestamp lt datetime'$((Get-Date).AddDays(-1).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ'))'"
2121
First = 10000
2222
Property = @('PartitionKey', 'RowKey', 'ETag')
2323
}
2424
}
2525
@{
2626
DataTableProps = @{
2727
Context = (Get-CIPPTable -tablename 'CippFunctionStats').Context
28-
Filter = "Timestamp lt datetime'$((Get-Date).AddDays(-7).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ'))'"
28+
Filter = "PartitionKey eq 'Durable' and Timestamp lt datetime'$((Get-Date).AddDays(-7).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ'))'"
2929
First = 10000
3030
Property = @('PartitionKey', 'RowKey', 'ETag')
3131
}
3232
}
3333
@{
3434
DataTableProps = @{
3535
Context = (Get-CIPPTable -tablename 'CippQueue').Context
36-
Filter = "Timestamp lt datetime'$((Get-Date).AddDays(-7).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ'))'"
36+
Filter = "PartitionKey eq 'CippQueue' and Timestamp lt datetime'$((Get-Date).AddDays(-7).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ'))'"
3737
First = 10000
3838
Property = @('PartitionKey', 'RowKey', 'ETag')
3939
}
4040
}
4141
@{
4242
DataTableProps = @{
4343
Context = (Get-CIPPTable -tablename 'CippQueueTasks').Context
44-
Filter = "Timestamp lt datetime'$((Get-Date).AddDays(-7).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ'))'"
44+
Filter = "PartitionKey eq 'Task' and Timestamp lt datetime'$((Get-Date).AddDays(-7).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ'))'"
4545
First = 10000
4646
Property = @('PartitionKey', 'RowKey', 'ETag')
4747
}
@@ -61,7 +61,7 @@ function Start-TableCleanup {
6161
try {
6262
Remove-AzDataTable -Context $Table.Context -Force
6363
} catch {
64-
Write-LogMessage -API 'TableCleanup' -message "Failed to delete table $($Table.Context.TableName)" -sev Error -LogData (Get-CippException -Exception $_)
64+
#Write-LogMessage -API 'TableCleanup' -message "Failed to delete table $($Table.Context.TableName)" -sev Error -LogData (Get-CippException -Exception $_)
6565
}
6666
}
6767
} catch {

0 commit comments

Comments
 (0)