Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to cancel all running Logic Apps #361

Closed
scleynen opened this issue Jan 11, 2023 · 4 comments · Fixed by #376
Closed

Add script to cancel all running Logic Apps #361

scleynen opened this issue Jan 11, 2023 · 4 comments · Fixed by #376
Assignees
Labels
area:logic-apps All issues related to Azure Logic Apps
Milestone

Comments

@scleynen
Copy link

scleynen commented Jan 11, 2023

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
@stijnmoreels
Copy link
Member

Thank you @scleynen for your issue!

@stijnmoreels stijnmoreels added the area:logic-apps All issues related to Azure Logic Apps label Jan 11, 2023
@stijnmoreels stijnmoreels added this to the v0.9.0 milestone Jan 11, 2023
@pim-simons
Copy link
Contributor

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?

@scleynen
Copy link
Author

Yes that worked.

But nevertheless it would be a handy script to have available without google it all the time.

@pim-simons
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:logic-apps All issues related to Azure Logic Apps
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants