From b07fe1f5d9f3f4e088ac3cd42a68a29905d459e6 Mon Sep 17 00:00:00 2001 From: John Duprey Date: Wed, 16 Aug 2023 12:07:06 -0400 Subject: [PATCH 1/4] BPA - Single Tenant Support --- BestPracticeAnalyser_Orchestration/run.ps1 | 19 ++++++++++++------- .../run.ps1 | 16 +++++++++------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/BestPracticeAnalyser_Orchestration/run.ps1 b/BestPracticeAnalyser_Orchestration/run.ps1 index 1ff8cf4659cb..7d74717c095e 100644 --- a/BestPracticeAnalyser_Orchestration/run.ps1 +++ b/BestPracticeAnalyser_Orchestration/run.ps1 @@ -1,17 +1,22 @@ param($Context) - $DurableRetryOptions = @{ - FirstRetryInterval = (New-TimeSpan -Seconds 5) - MaxNumberOfAttempts = 3 - BackoffCoefficient = 2 + FirstRetryInterval = (New-TimeSpan -Seconds 5) + MaxNumberOfAttempts = 3 + BackoffCoefficient = 2 } $RetryOptions = New-DurableRetryOptions @DurableRetryOptions -Write-LogMessage -API 'BestPracticeAnalyser' -tenant $tenant -message "Started BestPracticeAnalyser" -sev info +Write-LogMessage -API 'BestPracticeAnalyser' -tenant $tenant -message 'Started BestPracticeAnalyser' -sev info + +$TenantFilter = [string]$Context.Input.TenantFilter +if (![string]::IsNullOrEmpty($TenantFilter)) { + $Batch = @($TenantFilter) +} else { + $Batch = (Invoke-ActivityFunction -FunctionName 'BestPracticeAnalyser_GetQueue' -Input 'LetsGo') +} -$Batch = (Invoke-ActivityFunction -FunctionName 'BestPracticeAnalyser_GetQueue' -Input 'LetsGo') $ParallelTasks = foreach ($Item in $Batch) { - Invoke-DurableActivity -FunctionName 'BestPracticeAnalyser_All' -Input $item -NoWait -RetryOptions $RetryOptions + Invoke-DurableActivity -FunctionName 'BestPracticeAnalyser_All' -Input $item -NoWait -RetryOptions $RetryOptions } Write-LogMessage -API 'BestPracticeAnalyser' -tenant $tenant -message 'Best Practice Analyser has Finished' -sev Info \ No newline at end of file diff --git a/BestPracticeAnalyser_OrchestrationStarter/run.ps1 b/BestPracticeAnalyser_OrchestrationStarter/run.ps1 index 679c8aca1809..4d479c53e598 100644 --- a/BestPracticeAnalyser_OrchestrationStarter/run.ps1 +++ b/BestPracticeAnalyser_OrchestrationStarter/run.ps1 @@ -2,15 +2,17 @@ using namespace System.Net param($Request, $TriggerMetadata) if ($CurrentlyRunning) { - $Results = [pscustomobject]@{"Results" = "Already running. Please wait for the current instance to finish" } - Write-LogMessage -API "BestPracticeAnalyser" -message "Attempted to start analysis but an instance was already running." -sev Info -} -else { - $InstanceId = Start-NewOrchestration -FunctionName 'BestPracticeAnalyser_Orchestration' + $Results = [pscustomobject]@{'Results' = 'Already running. Please wait for the current instance to finish' } + Write-LogMessage -API 'BestPracticeAnalyser' -message 'Attempted to start analysis but an instance was already running.' -sev Info +} else { + $InputObject = @{ + TenantFilter = $Request.Query.TenantFilter + } + $InstanceId = Start-NewOrchestration -FunctionName 'BestPracticeAnalyser_Orchestration' -InputObject $InputObject Write-Host "Started orchestration with ID = '$InstanceId'" $Orchestrator = New-OrchestrationCheckStatusResponse -Request $Request -InstanceId $InstanceId - Write-LogMessage -API "BestPracticeAnalyser" -message "Started retrieving best practice information" -sev Info - $Results = [pscustomobject]@{"Results" = "Started running analysis" } + Write-LogMessage -API 'BestPracticeAnalyser' -message 'Started retrieving best practice information' -sev Info + $Results = [pscustomobject]@{'Results' = 'Started running analysis' } } Write-Host ($Orchestrator | ConvertTo-Json) From 5e4c7d8b2d73bd270b84f517d16d19f3cddd058a Mon Sep 17 00:00:00 2001 From: John Duprey Date: Wed, 16 Aug 2023 12:29:25 -0400 Subject: [PATCH 2/4] Update run.ps1 --- BestPracticeAnalyser_Orchestration/run.ps1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/BestPracticeAnalyser_Orchestration/run.ps1 b/BestPracticeAnalyser_Orchestration/run.ps1 index 7d74717c095e..11fa99a62ec4 100644 --- a/BestPracticeAnalyser_Orchestration/run.ps1 +++ b/BestPracticeAnalyser_Orchestration/run.ps1 @@ -8,9 +8,8 @@ $DurableRetryOptions = @{ $RetryOptions = New-DurableRetryOptions @DurableRetryOptions Write-LogMessage -API 'BestPracticeAnalyser' -tenant $tenant -message 'Started BestPracticeAnalyser' -sev info -$TenantFilter = [string]$Context.Input.TenantFilter -if (![string]::IsNullOrEmpty($TenantFilter)) { - $Batch = @($TenantFilter) +if ($Context.Input -and ![string]::IsNullOrEmpty([string]$Context.Input.TenantFilter)) { + $Batch = @([string]$Context.Input.TenantFilter) } else { $Batch = (Invoke-ActivityFunction -FunctionName 'BestPracticeAnalyser_GetQueue' -Input 'LetsGo') } From e215064363c02fb790e2e6be4c1279f56db10aac Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Wed, 16 Aug 2023 23:29:38 +0200 Subject: [PATCH 3/4] MessageCopyforSentAsDisabled mistake in table view --- Config/CIPPDefaultTable.BPATemplate.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Config/CIPPDefaultTable.BPATemplate.json b/Config/CIPPDefaultTable.BPATemplate.json index bb2d6667b15d..4c5e653ee1e6 100644 --- a/Config/CIPPDefaultTable.BPATemplate.json +++ b/Config/CIPPDefaultTable.BPATemplate.json @@ -109,7 +109,7 @@ "API": "Exchange", "Command": "Get-Mailbox", "Parameters": { - "RecipientTypeDetails": "SharedMailbox" + "RecipientTypeDetails": ["SharedMailbox", "UserMailbox"] }, "where": "$_.MessageCopyForSentAsEnabled -eq $false", "ExtractFields": ["userprincipalname", "messageCopyForSentAsEnabled"], From 513c1b597943d4e1be0b7f99c4c18f553b1d7a62 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Thu, 17 Aug 2023 01:11:11 +0200 Subject: [PATCH 4/4] upped version --- Scheduler_Alert/run.ps1 | 2 +- version_latest.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Scheduler_Alert/run.ps1 b/Scheduler_Alert/run.ps1 index 0aaad5d49932..e4831ef2be9e 100644 --- a/Scheduler_Alert/run.ps1 +++ b/Scheduler_Alert/run.ps1 @@ -169,7 +169,7 @@ try { } { $_.'ExpiringLicenses' -eq $true } { try { - Get-CIPPLicenseOverview -TenantFilter $Tenant.tenant | Where-Object -Property TimeUntilRenew -LT 31 | ForEach-Object { + Get-CIPPLicenseOverview -TenantFilter $Tenant.tenant | Where-Object -Property TimeUntilRenew -LT 29 | ForEach-Object { "$($_.License) will expire in $($_.TimeUntilRenew) days" } } diff --git a/version_latest.txt b/version_latest.txt index 0c89fc927e32..cc868b62c301 100644 --- a/version_latest.txt +++ b/version_latest.txt @@ -1 +1 @@ -4.0.0 \ No newline at end of file +4.0.1 \ No newline at end of file