Logic App utility to perform bulk operations on Standard Logic App workflow runs

This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Tech Community.

This PowerShell utility helps you to perform bulk operations on the Standard Logic App workflow runs. As Standard Logic App can host multiple workflows, this utility is scoped to perform on individual workflow. Hence, if you are in need of performing bulk operations on all workflows in a specific Standard Logic App, you need to execute the script on each workflow.

 

Below are the supported operations:

1. BulkCancel - Cancel running instances
2. BulkResubmitFailedRuns - Resubmits failed runs
3. BulkResubmitCancelledRuns - Resubmits cancelled runs
4. BulkResubmitSucceededRuns - Resubmits Succeeded runs

 

Steps to follow for executing the script:

 

1. Copy the PowerShell script to the desired folder.

 

2. Ignore this step if your using user creds to login. If not, proceed with creating App registration either using portal or CLI command. Refer this blog to create App Registration In Portal .You need to provide access to the App registration on Logic App/ Logic App Resource Group/Subscription level with LA Contributor or Contributor role access.

 

3. Open PowerShell with 'Run As administrator Privileges'.

 

4. Run the below command to bypass the execution policy and accept -Y

 

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

 

5. Change the directory to the PowerShell script folder where its available.

 

cd 'PowerShellScriptFolderPath'

 

6. Execute one of the below commands to perform the specified bulk operation on Consumption Logic App.

 

To Log-in with user credentials:

 

.\Standard_LogicApp_Utility.ps1 -SubscriptionId 'Subscription ID' -ResourceGroupName 'Resource Group Name' -LogicAppName 'Logic App Name' -WorkflowName 'WorkflowName' -Operation 'OperationName' -StartTime '2021-08-19T10:47:07.41621Z' -EndTime '2020-11-02T16:38:00.000Z’

 

Example:

.\Standard_LogicApp_Utility.ps1 -SubscriptionId '5bbbsassas-405ess-bc6b-c8sc2a6aa22551' -ResourceGroupName 'LAV2_HA_DR_PrimaryRegion' -LogicAppName 'LAV2Primary' -WorkflowName 'testftpflow' -Operation 'BulkResubmitCancelledRuns ' -StartTime '2021-08-19T10:47:07.41621Z'

 

To authenticate with App registration details:

 

.\Standard_LogicApp_Utility.ps1 -ClientId 'ClientId' -TenantId 'TenantId' -Secret 'Client Secret' -SubscriptionId 'SubscriptionId' -ResourceGroupName 'ResourceGroupName' -LogicAppName 'LogicAppName' -Operation 'OperationName' -WorkFlowName 'WorkFlowName' -StartTime '2020-11-02T16:33:00.000Z' -EndTime '2020-11-02T16:38:00.000Z’

 

Example:

.\Standard_LogicApp_Utility.ps1 -ClientId 'fa7a0dddaee-fbc2-4afa-a5aa-9b076933ac88' -TenantId '452f988bf-41af-91ab-2d7cd011db47' -Secret 'ABC12345 -ww' -SubscriptionId '544ds-ashhs-assh0ss' -ResourceGroupName 'LAV2_HA_DR_PrimaryRegion' -LogicAppName 'LAV2Primary' -WorkflowName 'testftpflow' -Operation 'BulkResubmitCancelledRuns ' -StartTime '2021-08-19T10:47:07.41621Z' -EndTime '2021-08-20T10:47:07.41621Z'

 

7. Log file gets generated in the script folder with the Run ids and their Start time, you may use these to cross verify the operation in the portal.

 

Parameters definition: 

 

S.No

Parameter Name

Mandatory

Comments

1

Client Id

No

The application /Client Id of your App Service Principal

2

Tenant Id

No

Tenant Id of Azure AD or App Service Principal

3

Client Secret

No

Secret of your App Service Principal

4

Subscription Id

Yes

Subscription Id where Logic App present

5

Resource Group Name

Yes

Resource group Name in which Logic App is present

6

Logic App Name

Yes

Name of the Logic App (Site Name)

7

Workflow Name

Yes

Name of the Workflow

7

Operation

Yes

Allowed Values:

BulkCancel - Cancel running instances

BulkResubmitFailedRuns - Resubmits failed runs

BulkResubmitCancelledRuns - Resubmits cancelled runs

BulkResubmitSucceededRuns - Resubmits Succeeded runs

8

StartTime

No

If present all above operations will be performed on the runs started from the specified time.

The Timestamp must be in UTC. 

Ex: 2020-11-02T16:33:00.000Z

9

EndTime

No

You can include the EndTime along with StartTime if you want to perform above operations between specific timestamps.

Note:

It is invalid without StartTime.

 

Script available in this Git-Hub repo: Standard-Logic-App--PowerShell-Utility/README.md at main · VeeraMS/Standard-Logic-App--PowerShell-Utility (github.com)

 

Note:

  • If you are using 'User login' method to authenticate Logic App, please install Azure CLI module Install the Azure CLI for Windows | Microsoft Docs.
  • Not recommended to run directly on the Production environment.
  • It is tested with limited test cases and volume of runs, Validate in test environments and then perform in Production.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.