[Powershell] Azure Automation – Delete all Azure Logic Apps in a Resource Group

In one of my recent projects I had a requirement to delete all the Logic Apps from a resource group on Azure. In this quick blog I’m sharing how to¬†delete all the logic apps in one go inside a resource group using the following Powershell script:


  • Service Principal Account Credentials (ClientId / Secret)
  • SubscriptionId
  • TenantId
  • ResourceGroupName

Please refer to this blog if you don’t know where to get¬†Service Principal Account Credentials – Managing Azure Logic Apps using .NET SDK.

Create the Service Principal Account and add a Contributor Role to it Рfor given subscription & resource group. You can find the commands in the blog mentioned above.

Write-Host 'Deleting Logic Apps...'
$resourceGroupName = <resource group>
$tenantId =<tenantId>
$clientId =<clientId>
$subscriptionId =<subscriptionId>
$secPassword = <secretPassword>
$secretPassword = ConvertTo-SecureString $secPassword -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ($clientId,$secretPassword)
Login-AzureRmAccount -ServicePrincipal -Tenant $tenantId -Credential $cred
Select-AzureRMSubscription -SubscriptionId $subscriptionId -tenantId $tenantId

$logicApps = @()
Find-AzureRmResource -ResourceGroupName LogicApps -ResourceType Microsoft.Logic/workflows | ForEach-Object{$logicApps += $_}

write-host $logicApps.Count 'Logic App(s) found'
foreach ($logicApp in $logicApps){
    write-host 'Deleting Logic App :' $logicApp.Name
    Remove-AzureRmLogicApp -ResourceGroupName $resourceGroupName -Name $logicApp.Name -Force
Happy Learning ūüôā

Leave a Comment