diff --git a/src/Arcus.Scripting.LogicApps/Scripts/Cancel-AzLogicAppRuns.ps1 b/src/Arcus.Scripting.LogicApps/Scripts/Cancel-AzLogicAppRuns.ps1 index 0a7fdfa2..d5259ef7 100644 --- a/src/Arcus.Scripting.LogicApps/Scripts/Cancel-AzLogicAppRuns.ps1 +++ b/src/Arcus.Scripting.LogicApps/Scripts/Cancel-AzLogicAppRuns.ps1 @@ -3,8 +3,8 @@ param( [Parameter(Mandatory = $true)][string] $LogicAppName = $(throw "Name of the logic app is required") ) -try{ - $runs = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $LogicAppName | +try { + $runs = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $LogicAppName -FollowNextPageLink | Where-Object {$_.Status -eq 'Running'} foreach ($run in $runs) { diff --git a/src/Arcus.Scripting.LogicApps/Scripts/Disable-AzLogicAppsFromConfig.ps1 b/src/Arcus.Scripting.LogicApps/Scripts/Disable-AzLogicAppsFromConfig.ps1 index e8f16d2b..c75f5222 100644 --- a/src/Arcus.Scripting.LogicApps/Scripts/Disable-AzLogicAppsFromConfig.ps1 +++ b/src/Arcus.Scripting.LogicApps/Scripts/Disable-AzLogicAppsFromConfig.ps1 @@ -57,16 +57,16 @@ function ExecuteCheckType() { } try { - $RunningRunsCount = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $logicApp -ErrorAction Stop | Where-Object Status -eq "Running" | Measure-Object | ForEach-Object { $_.Count } - $WaitingRunsCount = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $logicApp -ErrorAction Stop | Where-Object Status -eq "Waiting" | Measure-Object | ForEach-Object { $_.Count } + $RunningRunsCount = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $logicApp -FollowNextPageLink -ErrorAction Stop | Where-Object Status -eq "Running" | Measure-Object | ForEach-Object { $_.Count } + $WaitingRunsCount = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $logicApp -FollowNextPageLink -ErrorAction Stop | Where-Object Status -eq "Waiting" | Measure-Object | ForEach-Object { $_.Count } if ($RunningRunsCount -ne 0 -and $WaitingRunsCount -ne 0) { while ($RunningRunsCount -ne 0 -and $WaitingRunsCount -ne 0) { Write-Verbose "Azure Logic App '$logicApp' has Running and/or Waiting Runs, waiting 10 seconds and checking again..." Write-Debug "Number of running runs: $RunningRunsCount" Write-Debug "Number of waiting runs: $WaitingRunsCount" Start-Sleep -Second 10 - $RunningRunsCount = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $logicApp -ErrorAction Stop | Where-Object Status -eq "Running" | Measure-Object | ForEach-Object { $_.Count } - $WaitingRunsCount = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $logicApp -ErrorAction Stop | Where-Object Status -eq "Waiting" | Measure-Object | ForEach-Object { $_.Count } + $RunningRunsCount = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $logicApp -FollowNextPageLink -ErrorAction Stop | Where-Object Status -eq "Running" | Measure-Object | ForEach-Object { $_.Count } + $WaitingRunsCount = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $logicApp -FollowNextPageLink -ErrorAction Stop | Where-Object Status -eq "Waiting" | Measure-Object | ForEach-Object { $_.Count } if ($RunningRunsCount -eq 0 -and $WaitingRunsCount -eq 0) { Write-Verbose "Found no more waiting or running runs for Azure Logic App '$logicApp', executing stopType for Logic App" ExecuteStopType -resourceGroupName $ResourceGroupName -LogicAppName $logicApp -stopType $batch.stopType diff --git a/src/Arcus.Scripting.LogicApps/Scripts/Resubmit-FailedAzLogicAppRuns.ps1 b/src/Arcus.Scripting.LogicApps/Scripts/Resubmit-FailedAzLogicAppRuns.ps1 index 5118abe1..b95f45ac 100644 --- a/src/Arcus.Scripting.LogicApps/Scripts/Resubmit-FailedAzLogicAppRuns.ps1 +++ b/src/Arcus.Scripting.LogicApps/Scripts/Resubmit-FailedAzLogicAppRuns.ps1 @@ -7,10 +7,10 @@ param( try{ if ($EndTime) { - $runs = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $LogicAppName | + $runs = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $LogicAppName -FollowNextPageLink | Where-Object {$_.Status -eq 'Failed' -and $_.StartTime -ge $StartTime -and $_.EndTime -le $EndTime} } else { - $runs = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $LogicAppName | + $runs = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $LogicAppName -FollowNextPageLink | Where-Object {$_.Status -eq 'Failed' -and $_.StartTime -ge $StartTime} }