Rakesh Suryawanshi
Rakesh Suryawanshi

Reputation: 520

Delete individual workflows from Azure standard logic apps using automation

Delete individual workflows from Azure standard logic apps

I have few standard logic apps in my environment each logic app have few workflows, I would like to remove those logic app workflow using some automation tool such as azure cli or powershell or any other option.

I have not found anything related to this on the internet.

Upvotes: 0

Views: 606

Answers (1)

SwethaKandikonda
SwethaKandikonda

Reputation: 8254

Currently, There is no way that you can delete workflow using PowerShell or CLI. I tried using Rest API but even that didn't work as because the workflow any operation aren't supported by any of the methods. You can either completely delete the whole logic app using PowerShell or cli using the below commands.

PowerShell:

Remove-AzLogicApp -ResourceGroupName <RESOURCE_GROUP> -Name <LOGICAPP_NAME>

CLI:

az logic workflow delete --resource-group  "<RESOURCE_GROUP>"  --name  "<LOGICAPP_NAME>"

However, you can delete the workflow directly from portal or instead of deleting it, you can disable the logic app using the below PowerShell script. The below script disables all the workflows.

$Resource = Get-AzResource -ResourceId 'subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Web/sites/<LogicAppName>/workflows'

$Names = $Resource.Name

foreach($Name in $Names)                                                               
{
    $StartIndex = $Name.IndexOf('/')
    $workflow = $Name.substring($StartIndex+1)
    az functionapp config appsettings set --name <LogicAppName> --resource-group <ResourceGroupName> --settings Workflows.$workflow.FlowState=Disabled 
}

Upvotes: 0

Related Questions