Skip to content

Commit 1b281cb

Browse files
feat: Introduce MaximumFollowNextPageLink option for usage with Get-AzLogicAppRunHistory (#396)
Co-authored-by: Stijn Moreels <9039753+stijnmoreels@users.noreply.github.com> Co-authored-by: Pim Simons <pim.simons@codit.eu>
1 parent e014395 commit 1b281cb

9 files changed

Lines changed: 249 additions & 52 deletions

docs/preview/03-Features/powershell/azure-logic-apps.md

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ PS> Install-Module -Name Arcus.Scripting.LogicApps
1717

1818
Use this script to cancel all running instances for a specific Azure Logic App.
1919

20-
| Parameter | Mandatory | Description |
21-
| ------------------- | --------- | -------------------------------------------------- |
22-
| `ResourceGroupName` | yes | The resource group containing the Azure Logic App. |
23-
| `LogicAppName` | yes | The name of the Azure Logic App to be disabled. |
20+
| Parameter | Mandatory | Description |
21+
| --------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
22+
| `ResourceGroupName` | yes | The resource group containing the Azure Logic App. |
23+
| `LogicAppName` | yes | The name of the Azure Logic App for which the runs will be cancelled. |
24+
| `MaximumFollowNextPageLink` | no | This sets the amount of pages (30 runs per page) of the Logic App run history (if any) that are retrieved. If not supplied the default value is 10. |
2425

2526
**Example**
2627

@@ -37,12 +38,13 @@ PS> Cancel-AzLogicAppRuns `
3738

3839
Use this script to re-run a failed Azure Logic App run.
3940

40-
| Parameter | Mandatory | Description |
41-
| ------------------- | --------- | ---------------------------------------------------------------------------------------------------------- |
42-
| `ResourceGroupName` | yes | The resource group containing the Azure Logic App. |
43-
| `LogicAppName` | yes | The name of the Azure Logic App to be disabled. |
44-
| `StartTime` | yes | The start time in UTC for retrieving the failed instances. |
45-
| `EndTime` | no | The end time in UTC for retrieving the failed instances, if not supplied it will use the current datetime. |
41+
| Parameter | Mandatory | Description |
42+
| --------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
43+
| `ResourceGroupName` | yes | The resource group containing the Azure Logic App. |
44+
| `LogicAppName` | yes | The name of the Azure Logic App for which the failed runs will be resubmitted. |
45+
| `StartTime` | yes | The start time in UTC for retrieving the failed instances. |
46+
| `EndTime` | no | The end time in UTC for retrieving the failed instances, if not supplied it will use the current datetime. |
47+
| `MaximumFollowNextPageLink` | no | This sets the amount of pages (30 runs per page) of the Logic App run history (if any) that are retrieved. If not supplied the default value is 10. |
4648

4749
**Example**
4850

@@ -147,25 +149,25 @@ Typically done the first task of the release pipeline, right before the deployme
147149
The Azure Logic Apps to be disabled and the order in which this will be done, will be defined in the provided configuration file.
148150
The order of the Azure Logic Apps in the configuration file (bottom to top) defines the order in which they will be disabled by the script. The counterpart of this script used to enable the Azure Logic Apps, will take the order as specified (top to bottom) in the file.
149151

150-
| Parameter | Mandatory | Description |
151-
| ----------------- | --------- | ------------------------------------------------------------------------------------------------------------------- |
152-
| ResourceGroupName | yes | The resource group containing the Azure Logic Apps. |
153-
| DeployFileName | no | If your solution consists of multiple interfaces, you can specify the flow-specific name of the configuration file. |
154-
| ResourcePrefix | no | In case the Azure Logic Apps all start with the same prefix, you can specify this prefix through this parameter |
155-
| | | instead of updating the configuration-file. |
156-
| EnvironmentName | no | The name of the Azure environment where the Azure Logic App resides. (default: `AzureCloud`) |
157-
| ApiVersion | no | The version of the management API to be used. (default: `2016-06-01`) |
152+
| Parameter | Mandatory | Description |
153+
| ----------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
154+
| ResourceGroupName | yes | The resource group containing the Azure Logic Apps. |
155+
| DeployFileName | no | If your solution consists of multiple interfaces, you can specify the flow-specific name of the configuration file. |
156+
| ResourcePrefix | no | In case the Azure Logic Apps all start with the same prefix, you can specify this prefix through this parameter instead of updating the configuration-file. |
157+
| EnvironmentName | no | The name of the Azure environment where the Azure Logic App resides. (default: `AzureCloud`) |
158+
| ApiVersion | no | The version of the management API to be used. (default: `2016-06-01`) |
158159

159160
The schema of this configuration file is a JSON structure of an array with the following inputs:
160161

161-
| Node | Type | Description |
162-
| ----------- | --------------- | --------------------------------------------------------------------------------------------------------------------- |
163-
| Description | `string` | Description of Azure Logic App set to disable. |
164-
| CheckType | `enum` | `None`: don't perform any additional checks. |
165-
| | | `NoWaitingOrRunningRuns`: waits until there are no more waiting or running Logic App instances. |
166-
| StopType | `enum` | `None`: don't disable to given Logic Apps. |
167-
| | | `Immediate`: disable the given Logic Apps. |
168-
| LogicApps | `string array` | Set of Logic App names to disable. |
162+
| Node | Type | Description |
163+
| ------------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
164+
| Description | `string` | Description of Azure Logic App set to disable. |
165+
| MaximumFollowNextPageLink | `integer` | This sets the amount of pages (30 runs per page) of the Logic App run history (if any) that are retrieved. If not supplied the default value is 10. |
166+
| CheckType | `enum` | `None`: don't perform any additional checks. |
167+
| | | `NoWaitingOrRunningRuns`: waits until there are no more waiting or running Logic App instances. |
168+
| StopType | `enum` | `None`: don't disable to given Logic Apps. |
169+
| | | `Immediate`: disable the given Logic Apps. |
170+
| LogicApps | `string array` | Set of Logic App names to disable. |
169171

170172
**Example**
171173

@@ -177,6 +179,7 @@ Taking an example in which a set of Azure Logic Apps (`"rcv-shopping-order-*"`)
177179
"description": "Sender(s)",
178180
"checkType": "None",
179181
"stopType": "Immediate",
182+
"maximumFollowNextPageLink": 25,
180183
"logicApps": [
181184
"snd-shopping-order-confirmation-smtp"
182185
]
@@ -293,25 +296,23 @@ Typically done as the last task of the release pipeline, right after the deploym
293296
The Azure Logic Apps to be enabled and the order in which this will be done, will be defined in the provided configuration file.
294297
The order of the Azure Logic Apps in the configuration file (top to bottom) defines the order in which they will be enabled by the script. The counterpart of this script used to disable the Azure Logic Apps, will take the reversed order as specified (bottom to top) in the file.
295298

296-
| Parameter | Mandatory | Description |
297-
| ----------------- | --------- | ------------------------------------------------------------------------------------------------------------------- |
298-
| ResourceGroupName | yes | The resource group containing the Azure Logic Apps. |
299-
| DeployFileName | no | If your solution consists of multiple interfaces, you can specify the flow-specific name of the configuration file. |
300-
| ResourcePrefix | no | In case the Azure Logic Apps all start with the same prefix, you can specify this prefix through this parameter |
301-
| | | instead of updating the configuration-file. |
302-
| EnvironmentName | no | The name of the Azure environment where the Azure Logic App resides. (default: `AzureCloud`) |
303-
| ApiVersion | no | The version of the management API to be used. (default: `2016-06-01`) |
299+
| Parameter | Mandatory | Description |
300+
| ----------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
301+
| ResourceGroupName | yes | The resource group containing the Azure Logic Apps. |
302+
| DeployFileName | no | If your solution consists of multiple interfaces, you can specify the flow-specific name of the configuration file. |
303+
| ResourcePrefix | no | In case the Azure Logic Apps all start with the same prefix, you can specify this prefix through this parameter instead of updating the configuration-file. |
304+
| EnvironmentName | no | The name of the Azure environment where the Azure Logic App resides. (default: `AzureCloud`) |
305+
| ApiVersion | no | The version of the management API to be used. (default: `2016-06-01`) |
304306

305307
The schema of this configuration file is a JSON structure of an array with the following inputs:
306308

307309
| Node | Type | Description |
308310
| ----------- | --------------- | --------------------------------------------------------------------------------------------------------------------- |
309-
| Description | `string` | Description of Azure Logic App set to enable. |
310-
| CheckType | `enum` | _Not taken into account for enabling Logic Apps._ |
311-
| StopType | `enum` | `None`: don't enable to given Logic Apps. |
312-
| | | `Immediate`: enable the given Logic Apps. |
313-
| LogicApps | `string array` | Set of Logic App names to enable. |
314-
311+
| Description | `string` | Description of Azure Logic App set to enable. |
312+
| CheckType | `enum` | _Not taken into account for enabling Logic Apps._ |
313+
| StopType | `enum` | `None`: don't enable to given Logic Apps. |
314+
| | | `Immediate`: enable the given Logic Apps. |
315+
| LogicApps | `string array` | Set of Logic App names to enable. |
315316
**Example**
316317

317318
Taking an example in which a set of Azure Logic Apps (`"rcv-shopping-order-*"`) need to be enabled, the following configuration will ignore the `checkType`, as this is only used for disabling the Logic Apps, and will simply enable them (`stopType = Immediate`), starting with the _sender_ instances and working its way down to the _receive protocol_ Logic Apps.

src/Arcus.Scripting.LogicApps/Arcus.Scripting.LogicApps.psm1

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,18 @@
1111
.Parameter LogicAppName
1212
The name of the Azure Logic App.
1313
14+
.Parameter MaximumFollowNextPageLink
15+
The number of times the script should retrieve the next page of Logic App runs, if not specified the entire run history of the Logic App will be retrieved.
16+
1417
#>
1518
function Cancel-AzLogicAppRuns {
1619
param(
1720
[Parameter(Mandatory = $true)][string] $ResourceGroupName = $(throw "Name of the resource group is required"),
18-
[Parameter(Mandatory = $true)][string] $LogicAppName = $(throw "Name of the logic app is required")
21+
[Parameter(Mandatory = $true)][string] $LogicAppName = $(throw "Name of the logic app is required"),
22+
[Parameter(Mandatory = $false)][int] $MaximumFollowNextPageLink = 10
1923
)
2024

21-
. $PSScriptRoot\Scripts\Cancel-AzLogicAppRuns.ps1 -ResourceGroupName $ResourceGroupName -LogicAppName $LogicAppName
25+
. $PSScriptRoot\Scripts\Cancel-AzLogicAppRuns.ps1 -ResourceGroupName $ResourceGroupName -LogicAppName $LogicAppName -MaximumFollowNextPageLink $MaximumFollowNextPageLink
2226
}
2327

2428
Export-ModuleMember -Function Cancel-AzLogicAppRuns
@@ -42,19 +46,23 @@ Export-ModuleMember -Function Cancel-AzLogicAppRuns
4246
.Parameter EndTime
4347
The end time of the failed instances of the Azure Logic App.
4448
49+
.Parameter MaximumFollowNextPageLink
50+
The number of times the script should retrieve the next page of Logic App runs, if not specified the entire run history of the Logic App will be retrieved.
51+
4552
#>
4653
function Resubmit-FailedAzLogicAppRuns {
4754
param(
4855
[Parameter(Mandatory = $true)][string] $ResourceGroupName = $(throw "Name of the resource group is required"),
4956
[Parameter(Mandatory = $true)][string] $LogicAppName = $(throw "Name of the logic app is required"),
5057
[Parameter(Mandatory = $true)][datetime] $StartTime = $(throw "Start time is required"),
51-
[Parameter(Mandatory = $false)][datetime] $EndTime
58+
[Parameter(Mandatory = $false)][datetime] $EndTime,
59+
[Parameter(Mandatory = $false)][int] $MaximumFollowNextPageLink = 10
5260
)
5361

5462
if ($EndTime) {
55-
. $PSScriptRoot\Scripts\Resubmit-FailedAzLogicAppRuns.ps1 -ResourceGroupName $ResourceGroupName -LogicAppName $LogicAppName -StartTime $StartTime -EndTime $EndTime
63+
. $PSScriptRoot\Scripts\Resubmit-FailedAzLogicAppRuns.ps1 -ResourceGroupName $ResourceGroupName -LogicAppName $LogicAppName -StartTime $StartTime -EndTime $EndTime -MaximumFollowNextPageLink $MaximumFollowNextPageLink
5664
} else {
57-
. $PSScriptRoot\Scripts\Resubmit-FailedAzLogicAppRuns.ps1 -ResourceGroupName $ResourceGroupName -LogicAppName $LogicAppName -StartTime $StartTime
65+
. $PSScriptRoot\Scripts\Resubmit-FailedAzLogicAppRuns.ps1 -ResourceGroupName $ResourceGroupName -LogicAppName $LogicAppName -StartTime $StartTime -MaximumFollowNextPageLink $MaximumFollowNextPageLink
5866
}
5967
}
6068

src/Arcus.Scripting.LogicApps/Scripts/Cancel-AzLogicAppRuns.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
param(
22
[Parameter(Mandatory = $true)][string] $ResourceGroupName = $(throw "Name of the resource group is required"),
3-
[Parameter(Mandatory = $true)][string] $LogicAppName = $(throw "Name of the logic app is required")
3+
[Parameter(Mandatory = $true)][string] $LogicAppName = $(throw "Name of the logic app is required"),
4+
[Parameter(Mandatory = $false)][int] $MaximumFollowNextPageLink = 10
45
)
56

67
try {
7-
$runs = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $LogicAppName -FollowNextPageLink |
8+
$runs = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $LogicAppName -FollowNextPageLink -MaximumFollowNextPageLink $MaximumFollowNextPageLink |
89
Where-Object {$_.Status -eq 'Running'}
910

1011
foreach ($run in $runs) {

0 commit comments

Comments
 (0)