Have you ever wanted to stop all logic apps in a resource group in one go – either for production maintenance, or maybe because that set of logic apps in a resource group is eating all your resources? If so, welcome to the club… What you probably found is that there is no way to do this in the portal. Coming from a BizTalk background where you can stop all orchestration – or even the whole application) with a right click, in some cases you will ask “Why?”, while in others you might shout “Khaaaannn!” (I know I probably did both).In those situations, powershell is your friend! And it is not too difficult… I created a script for that some time ago, before the blog was created and almost forgot about it – although I hunt it down again every time that I need to do maintenance on some of my applications. Then a post in the Logic Apps MSDN forum reminded me that I haven’t posted that solution yet. So here it go. You can find it in this gist (with some comments on usage), if you want to download.
If you follow the blog, you probably saw some of this code before, as I used it to loop through all logic apps in a resource group when I was extracting the logic apps templates – actually this code gave me the idea to do the same on that case.
One you have a list of logic apps, the only thing you need to do is to set the correct state using this command:
Set-AzureRmLogicApp -ResourceGroupName $_.ResourceGroupName -Name $_.Name -State $state -Force
Where $state is either “Enabled” or “Disabled”
Told you it was simple… See you next time!
8 thoughts on “Enable/disable all logic apps in a resource group”
Thanks for this wonderful post. But I am facing one issue when I have the integration Account linked with my Logic App.
[ERROR]Set-AzureRmLogicApp : The integration account id must be provided in the
[ERROR] ‘integrationAccount’ property of the workflow ‘Test_LA’.
I have already tried with following but still getting the same error.
Set-AzureRmLogicApp -ResourceGroupName $_.ResourceGroupName -Name $_.Name -State $state -IntegrationAccountId $integrationaccount -Force
Could you please suggest some solution on this.
I have to do some research on this one. I will try to look into this during the week and come back to you on it.
I could not get this to work because I think powershell has moved on.
I think this is a link that uses the latest version of AzurePowershell
I just added
#Logic Apps with Recurrence Trigger
$logicApps = Get-AzLogicApp -ResourceGroupName $resourceGroupName
foreach($logicApp in $logicApps)
ChangeLogicAppState -logicAppName $logicApp.Name -desiredState $desiredState -resourceGroupName $resourceGroupName
to get it to loop around all logic apps in a resource group and disable them.
Thanks for that. I will update the powershell script. It has bee a while… 😉
I have 10 logic apps in that few have linked with integration account some of not. then how to disable all logic apps by below script, getting error
Cannot index into a null array.
At line:7 char:5
+ if ($result[‘environment’] -eq “uat”)
+ CategoryInfo : InvalidOperation: (:) , RuntimeException
+ FullyQualifiedErrorId : NullArray
$logicApps = Get-AzResource -ResourceType “Microsoft.Logic/workflows” -ResourceGroupName “resourcegroupname”
foreach($logicApp in $logicApps)
$result = $logicApp.Tags
if ($result[‘environment’] -eq “uat”)
Set-AzLogicApp -ResourceGroupName “” -Name $logicApp.Name -State “Disabled” -Force
I have to refresh this script to work with the enterprise account. Seems like is an issue on it.