DEV Community

Cover image for Resubmit Logic Apps using C# ❤❤
Rajkumar Balakrishnan
Rajkumar Balakrishnan

Posted on

Resubmit Logic Apps using C# ❤❤

Ok. Straight to the point. The logic app that am supposed to monitor ( which I did not apparently, quite well ) failed a terrible 492 odd times. When I did notice the failures, it was quite late as you can Imagine.
Ah Ok !! The Logic App had one of its API Connections misconfigured. Gotcha.. Got that fixed. Now all the failed instances of the logic app needs to be re-run
Like everyone else I was looking for a Select All Checkbox + ReSubmit Button and found it nowhere. The only option left was to select 492 check boxes ( individually ) and then Resubmit in OMS. And am not a great fan of clicking my way out.

So ended up writing a C# Console Application that can Iteratively resubmit each instance of the failed logic app.

There are three things to be done to accomplish in order to bulk resubmit the failed logic apps

  • GetAccessToken
  • GetWorkflowHistoryRuns
  • ReSubmitFailedLogicApps

What do you need to Know to Run this Console Application ?

There are few settings that needs to be configured before running the App

  1. AAD TenantId
  2. Client AppId and Secret that has contributor permissions to the ResourceGroup Running the Logic App
  3. Subscription Id, Resource Group Name, Logic App Name and the trigger name of the Logic App

How does it work ?

  • GetAccessToken fetches the bearer token to transact with Azure Management API’s
  • GetWorkflowHistoryRuns fetches the list of failed logic app instances Iteratively
  • ReSubmitFailedLogicApps submits the list of failed logic app instances to Azure to be Re-Run

Discussion (0)