Skip to content

Commit 45580d5

Browse files
committed
Fix property assignment and config validation in orchestrators
Updated Push-AuditLogTenantDownload.ps1 to use Add-Member with -Force for CippStatus and Error property assignments, ensuring properties are set correctly. Improved Start-ExtensionOrchestrator.ps1 to check for non-empty ExtensionConfig before validating JSON, preventing errors when config is null or empty.
1 parent ebfd5ef commit 45580d5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Webhooks/Push-AuditLogTenantDownload.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ function Push-AuditLogTenantDownload {
4343
Write-Information ('Audit Logs: Found {0} searches, begin downloading' -f $LogSearches.Count)
4444
foreach ($Search in $LogSearches) {
4545
$SearchEntity = Get-CIPPAzDataTableEntity @LogSearchesTable -Filter "Tenant eq '$($TenantFilter)' and RowKey eq '$($Search.id)'"
46-
$SearchEntity.CippStatus = 'Processing'
46+
$SearchEntity | Add-Member -NotePropertyName CippStatus -NotePropertyValue 'Processing' -Force
4747
Add-CIPPAzDataTableEntity @LogSearchesTable -Entity $SearchEntity -Force
4848
try {
4949
Write-Information "Audit Log search: Processing search ID: $($Search.id) for tenant: $TenantFilter"
5050
$Downloads = New-CIPPAuditLogSearchResultsCache -TenantFilter $TenantFilter -searchId $Search.id
51-
$SearchEntity.CippStatus = 'Downloaded'
51+
$SearchEntity | Add-Member -NotePropertyName CippStatus -NotePropertyValue 'Downloaded' -Force
5252
} catch {
5353
if ($_.Exception.Message -match 'Request rate is large. More Request Units may be needed, so no changes were made. Please retry this request later.') {
54-
$SearchEntity.CippStatus = 'Pending'
54+
$SearchEntity | Add-Member -NotePropertyName CippStatus -NotePropertyValue 'Pending' -Force
5555
Write-Information "Audit Log search: Rate limit hit for $($SearchEntity.RowKey)."
5656
if ($SearchEntity.PSObject.Properties.Name -contains 'RetryCount') {
5757
$SearchEntity.RetryCount++
@@ -60,8 +60,8 @@ function Push-AuditLogTenantDownload {
6060
}
6161
} else {
6262
$Exception = [string](ConvertTo-Json -Compress -InputObject (Get-CippException -Exception $_))
63-
$SearchEntity | Add-Member -MemberType NoteProperty -Name Error -Value $Exception
64-
$SearchEntity.CippStatus = 'Failed'
63+
$SearchEntity | Add-Member -MemberType NoteProperty -Name Error -Value $Exception -Force
64+
$SearchEntity | Add-Member -NotePropertyName CippStatus -NotePropertyValue 'Failed' -Force
6565
Write-Information "Error processing audit log rules: $($_.Exception.Message)"
6666
}
6767

Modules/CIPPCore/Public/Entrypoints/Orchestrator Functions/Start-ExtensionOrchestrator.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function Start-ExtensionOrchestrator {
1010

1111
$Table = Get-CIPPTable -TableName Extensionsconfig
1212
$ExtensionConfig = (Get-AzDataTableEntity @Table).config
13-
if (Test-Json -Json $ExtensionConfig) {
13+
if ($ExtensionConfig -and (Test-Json -Json $ExtensionConfig)) {
1414
$Configuration = ($ExtensionConfig | ConvertFrom-Json)
1515
} else {
1616
$Configuration = @{}

0 commit comments

Comments
 (0)