This article is contributed. See the original author and article here.
This PowerShell utility can be used to manage the Logic App runs such as cancelling or resubmitting the runs.
It supports the below operations.
- BulkCancel – Cancel running instances
- BulkResubmitFailedRuns – Resubmits failed runs
- BulkResubmitCancelledRuns – Resubmits cancelled runs
- BulkResubmitSucceededRuns – Resubmits Succeeded runs
Steps to follow for executing the script:
- Copy the PowerShell script attached to desired folder from here LogicAppUtility.ps1
- Set up Azure Service Principal – Contributor access on the Subscription. You can refer below doc for creating Azure app registration Create Azure SPN
- Open PowerShell with ‘Run As administrator Privileges’
- Run the below command to bypass the execution policy and accept -Y
- Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
- Change the directory to the PowerShell script copied folder in first step.
- cd ‘PowerShellScriptFolderPath’
- Execute the command to perform the different mentioned operations on Logic App.
.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 ‘Operation name‘ -StartTime ‘Enter start datetime on UTC‘ -EndTime ‘Enter end datetime in UTC’
- Validate the text file gets created in the same folder for list of run ids that are executed on specified operation.
Parameters definition:
S.No | Parameter Name | Mandatory | Comments |
1 | Client Id | Yes | The application /Client Id of your App Service Principal |
2 | Tenant Id | Yes | Tenant Id of Azure AD or App Service Principal |
3 | Client Secret | Yes | 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: Download Link
Note:
- 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
Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.
Recent Comments