From 75cc04bfae53ba030ad8b9cb29aecc2fad7c6e1e Mon Sep 17 00:00:00 2001 From: John Duprey Date: Tue, 9 Jul 2024 12:51:33 -0400 Subject: [PATCH] Add logging --- .../CIPP/Settings/Invoke-ExecExtensionsConfig.ps1 | 3 ++- .../CippExtensions/Public/Hudu/Invoke-HuduExtensionSync.ps1 | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecExtensionsConfig.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecExtensionsConfig.ps1 index 699c443d80a7..40479df6de08 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecExtensionsConfig.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecExtensionsConfig.ps1 @@ -69,7 +69,8 @@ Function Invoke-ExecExtensionsConfig { Add-CIPPAzDataTableEntity @Table -Entity $Config -Force | Out-Null - $CippUri = [System.Uri]$TriggerMetadata.Headers.'x-ms-original-url' + $Uri = $TriggerMetadata.Headers.referer ?? $TriggerMetadata.Headers.'x-ms-original-url' + $CippUri = [System.Uri]$Uri $AddObject = @{ PartitionKey = 'InstanceProperties' RowKey = 'CIPPURL' diff --git a/Modules/CippExtensions/Public/Hudu/Invoke-HuduExtensionSync.ps1 b/Modules/CippExtensions/Public/Hudu/Invoke-HuduExtensionSync.ps1 index 09518896bf9b..405b48b8d514 100644 --- a/Modules/CippExtensions/Public/Hudu/Invoke-HuduExtensionSync.ps1 +++ b/Modules/CippExtensions/Public/Hudu/Invoke-HuduExtensionSync.ps1 @@ -906,10 +906,12 @@ function Invoke-HuduExtensionSync { } } catch { $CompanyResult.Errors.add("Company: Failed to import domain: $_") + Write-LogMessage -tenant $Tenant.defaultDomainName -tenantid $Tenant.customerId -API 'Hudu Sync' -message "Company: Failed to import domain: $_" -level 'Error' } - + Write-LogMessage -tenant $Tenant.defaultDomainName -tenantid $Tenant.customerId -API 'Hudu Sync' -message 'Company: Completed Sync' -level 'Information' } catch { $CompanyResult.Errors.add("Company: A fatal error occured: $_") + Write-LogMessage -tenant $Tenant.defaultDomainName -tenantid $Tenant.customerId -API 'Hudu Sync' -message "Company: A fatal error occured: $_" -level 'Error' } return $CompanyResult }