Add script to cancel all running Logic Apps
Closed this issue · 4 comments
Is your feature request related to a problem? Please describe.
Sometimes fe. when accidently a big load is triggered you want to cancel all running instances of a LogicApp. In the portal you can do it only on individual base.
Describe the solution you'd like
This powershell is something I found, but Get-AzureRmLogicAppRunHistory is not giving all results at once. It is "paged". So we need a sript which is following the nextlink in the paged result an cancels all the running.
$runs = Get-AzureRmLogicAppRunHistory -ResourceGroupName "Test" -Name "Canvas" |
Where-Object {$_.Status -eq 'Running'} |
Stop-AzureRmLogicAppRun -ResourceGroupName "Test" -Name "Canvas" -RunName {$_.Name} -Force
Thank you @scleynen for your issue!
I see there is a new Az version of this script, see https://learn.microsoft.com/en-us/powershell/module/az.logicapp/get-azlogicapprunhistory?view=azps-9.3.0.
This Az script has the parameters FollowNextPageLink
and MaximumFollowNextPageLink
, it would seem that script is able to follow the nextLink pages "out-of-the-box".
@scleynen could you test if the Get-AzLogicAppRunHistory
does the job for you?
Yes that worked.
But nevertheless it would be a handy script to have available without google it all the time.
Great to hear it worked!
Could you share the entire powershell script you used with Get-AzLogicAppRunHistory
to cancel all running Logic Apps? So I can see if and how we can best implement this in Arcus.Scripting.LogicApps
.