Logic App utility to perform bulk operations on Consumption Logic App runs
Published Apr 06 2021 11:45 PM 3,922 Views
Iron Contributor

This PowerShell utility helps you to perform bulk operations on the Consumption Logic App runs. Below are the supported operations with this utility.

 

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:

 

.\LogicAppUtility.ps1 -SubscriptionId 'Enter Subscription Id' -ResourceGroupName 'Enter resource Group Name' -LogicAppName 'Enter Logic App Name' -Operation 'OperationName' -StartTime '2020-11-02T16:33:00.000Z' -EndTime '2020-11-02T16:38:00.000Z’

 

Ex:

.\LogicAppUtility.ps1  -SubscriptionId 'sddd-dsd-45-455' -ResourceGroupName 'TestRg' -LogicAppName 'MyTestLA -Operation 'BulkCancel' -StartTime '2020-11-02T16:33:00.000Z' -EndTime '2020-11-02T16:38:00.000Z’

 

To authenticate with App registration details:

 

.\LogicAppUtility.ps1 -ClientId 'Enter ClientId' -TenantId 'Enter TenantId' -Secret 'Enter Secret' -SubscriptionId 'Enter Subscription Id' -ResourceGroupName 'Enter resource Group Name' -LogicAppName 'Enter Logic App Name' -Operation 'OperationName' -StartTime '2020-11-02T16:33:00.000Z' -EndTime '2020-11-02T16:38:00.000Z’

 

Ex:

.\LogicAppUtility.ps1 -ClientId '45dd-45tg88rt-45re' -TenantId 'sdd87-sdsd87-788d-858d' -Secret 'ABCSecret' -SubscriptionId 'dsd78-sd87-85tr-96rh-7895-fhfh' -ResourceGroupName 'MYRG' -LogicAppName 'MyTestLA' -Operation 'BulkCancel' -StartTime '2020-11-02T16:33:00.000Z' -EndTime '2020-11-02T16:38:00.000Z

 

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 your Logic App

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: VeeraMS/Consumption-Logic-App--PowerShell-Utility: This PowerShell utility lets you do bulk operatio...

 

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
1 Comment
Co-Authors
Version history
Last update:
‎Aug 25 2021 12:22 AM
Updated by: