Skip to content

Commit 901830b

Browse files
Merge pull request #241301 from ecfan/affinity
Azure Logic Apps: Enable stateful mode for stateless built-in connectors
2 parents e7642e7 + efccd11 commit 901830b

File tree

6 files changed

+205
-3
lines changed

6 files changed

+205
-3
lines changed

articles/connectors/connectors-create-api-servicebus.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services: logic-apps
55
ms.suite: integration
66
ms.reviewer: estfan, azla
77
ms.topic: how-to
8-
ms.date: 03/23/2023
8+
ms.date: 06/13/2023
99
ms.custom: engagement-fy23
1010
tags: connectors
1111
---
@@ -57,6 +57,8 @@ The Service Bus connector has different versions, based on [logic app workflow t
5757

5858
For more information about managed identities, review [Authenticate access to Azure resources with managed identities in Azure Logic Apps](../logic-apps/create-managed-service-identity.md).
5959

60+
* By default, the Service Bus built-in connector operations are stateless. To run these operations in stateful mode, see [Enable stateful mode for stateless built-in connectors](../connectors/enable-stateful-affinity-built-in-connectors.md).
61+
6062
## Considerations for Azure Service Bus operations
6163

6264
### Infinite loops
@@ -280,6 +282,8 @@ The steps to add and use a Service Bus trigger differ based on whether you want
280282

281283
#### Built-in connector trigger
282284

285+
The built-in Service Bus connector is a stateless connector, by default. To run this connector's operations in stateful mode, see [Enable stateful mode for stateless built-in connectors](enable-stateful-affinity-built-in-connectors.md).
286+
283287
1. In the [Azure portal](https://portal.azure.com), and open your blank logic app workflow in the designer.
284288

285289
1. On the designer, select **Choose an operation**.
@@ -436,6 +440,8 @@ The steps to add and use a Service Bus action differ based on whether you want t
436440

437441
#### Built-in connector action
438442

443+
The built-in Service Bus connector is a stateless connector, by default. To run this connector's operations in stateful mode, see [Enable stateful mode for stateless built-in connectors](enable-stateful-affinity-built-in-connectors.md).
444+
439445
1. In the [Azure portal](https://portal.azure.com), and open your logic app workflow in the designer.
440446

441447
1. Under the trigger or action where you want to add the action, select the plus sign (**+**), and then select **Add an action**.
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
---
2+
title: Enable stateful mode for stateless built-in connectors
3+
description: Enable stateless built-in connectors to run in stateful mode for Standard workflows in Azure Logic Apps.
4+
services: logic-apps
5+
ms.suite: integration
6+
ms.reviewer: estfan, edwardhe, azla
7+
ms.topic: how-to
8+
ms.date: 06/13/2023
9+
---
10+
11+
# Enable stateful mode for stateless built-in connectors in Azure Logic Apps
12+
13+
[!INCLUDE [logic-apps-sku-standard](../../includes/logic-apps-sku-standard.md)]
14+
15+
In Standard logic app workflows, the following built-in, service provider-based connectors are stateless, by default:
16+
17+
- Azure Service Bus
18+
- SAP
19+
20+
To run these connector operations in stateful mode, you must enable this capability. This how-to guide shows how to enable stateful mode for these connectors.
21+
22+
## Prerequisites
23+
24+
- An Azure account and subscription. If you don't have a subscription, [sign up for a free Azure account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
25+
26+
- The Standard logic app resource where you plan to create the workflow that uses the stateful mode-enabled connector operations. If you don't have this resource, [create your Standard logic app resource now](../logic-apps/create-single-tenant-workflows-azure-portal.md).
27+
28+
- An Azure virtual network with a subnet to integrate with your logic app. If you don't have these items, see the following documentation:
29+
30+
- [Quickstart: Create a virtual network with the Azure portal](../virtual-network/quick-create-portal.md)
31+
- [Add, change, or delete a virtual network subnet](../virtual-network/virtual-network-manage-subnet.md?tabs=azure-portal)
32+
33+
## Enable stateful mode in the Azure portal
34+
35+
1. In the [Azure portal](https://portal.azure.com), open the Standard logic app resource where you want to enable stateful mode for these connector operations.
36+
37+
1. Enable virtual network integration for your logic app and add your logic app to the previously created subnet:
38+
39+
1. On your logic app menu resource, under **Settings**, select **Networking**.
40+
41+
1. In the **Outbound Traffic** section, select **VNET integration** > **Add VNet**.
42+
43+
1. On the **Add VNet Integration** pane that opens, select your Azure subscription and your virtual network.
44+
45+
1. Under **Subnet**, select **Select existing**. From the **Subnet** list, select the subnet where you want to add your logic app.
46+
47+
1. When you're done, select **OK**.
48+
49+
On the **Networking** page, the **VNet integration** option now appears set to **On**, for example:
50+
51+
:::image type="content" source="media/enable-stateful-affinity-built-in-connectors/enable-virtual-network-integration.png" alt-text="Screenshot shows Azure portal, Standard logic app resource, Networking page, VNet integration set to On.":::
52+
53+
For general information about enabling virtual network integration with your app, see [Enable virtual network integration in Azure App Service](../app-service/configure-vnet-integration-enable.md).
54+
55+
1. Next, update your logic app's underlying website configuration (**<*logic-app-name*>.azurewebsites.net**) by using either of the following tools:
56+
57+
## Update website configuration for logic app
58+
59+
After you enable virtual network integration for your logic app, you must update your logic app's underlying website configuration (**<*logic-app-name*>.azurewebsites.net**) by using one the following methods:
60+
61+
- [Azure Resource Management API](#azure-resource-management-api) (bearer token required)
62+
- [Azure PowerShell](#azure-powershell) (bearer token *not* required)
63+
64+
### Azure Resource Management API
65+
66+
To complete this task with the [Azure Resource Management API - Update By Id](/rest/api/resources/resources/update-by-id), review the following requirements, syntax, and parameter values.
67+
68+
#### Requirements
69+
70+
OAuth authorization and the bearer token are required. To get the bearer token, follow these steps
71+
72+
1. While you're signed in to the Azure portal, open your web browser's developer tools (F12).
73+
74+
1. Get the token by sending any management request, for example, by saving a workflow in your Standard logic app.
75+
76+
#### Syntax
77+
78+
Updates a resource by using the specified resource ID:
79+
80+
`PATCH https://management.azure.com/{resourceId}?api-version=2021-04-01`
81+
82+
#### Parameter values
83+
84+
| Element | Value | Description |
85+
|---------|--------|-------------|
86+
| HTTP request method | **PATCH** |
87+
| <*resourceId*> | **subscriptions/{yourSubscriptionID}/resourcegroups/{yourResourceGroup}/providers/Microsoft.Web/sites/{websiteName}/config/web** |
88+
| <*yourSubscriptionId*> | The ID for your Azure subscription |
89+
| <*yourResourceGroup*> | The resource group that contains your logic app resource |
90+
| <*websiteName*> | The name for your logic app resource, which is **mystandardlogicapp** in this example |
91+
| HTTP request body | **{"properties": {"vnetPrivatePortsCount": "2"}}** |
92+
93+
#### Example
94+
95+
`https://management.azure.com/subscriptions/XXxXxxXX-xXXx-XxxX-xXXX-XXXXxXxXxxXX/resourcegroups/My-Standard-RG/providers/Microsoft.Web/sites/mystandardlogicapp/config/web?api-version=2021-02-01`
96+
97+
### Azure PowerShell
98+
99+
To complete this task with Azure PowerShell, review the following requirements, syntax, and values. This method doesn't require that you manually get the bearer token.
100+
101+
#### Syntax
102+
103+
```powershell
104+
Set-AzContext -Subscription {yourSubscriptionID}
105+
$webConfig = Get-AzResource -ResourceId {resourceId}
106+
$webConfig.Properties.vnetPrivatePortsCount = 2
107+
$webConfig | Set-AzResource -ResourceId {resourceId}
108+
```
109+
110+
For more information, see the following documentation:
111+
112+
- [Set-AzContext](/powershell/module/az.accounts/set-azcontext)
113+
- [Get-AzResource](/powershell/module/az.resources/get-azresource)
114+
- [Set-AzResource](/powershell/module/az.resources/set-azresource)
115+
116+
#### Parameter values
117+
118+
| Element | Value |
119+
|---------|--------|
120+
| <*yourSubscriptionID*> | The ID for your Azure subscription |
121+
| <*resourceId*> | **subscriptions/{yourSubscriptionID}/resourcegroups/{yourResourceGroup}/providers/Microsoft.Web/sites/{websiteName}/config/web** |
122+
| <*yourResourceGroup*> | The resource group that contains your logic app resource |
123+
| <*websiteName*> | The name for your logic app resource, which is **mystandardlogicapp** in this example |
124+
125+
#### Example
126+
127+
`https://management.azure.com/subscriptions/XXxXxxXX-xXXx-XxxX-xXXX-XXXXxXxXxxXX/resourcegroups/My-Standard-RG/providers/Microsoft.Web/sites/mystandardlogicapp/config/web?api-version=2021-02-01`
128+
129+
#### Troubleshoot errors
130+
131+
##### Error: Reserved instance count is invalid
132+
133+
If you get an error that says **Reserved instance count is invalid**, use the following workaround:
134+
135+
```powershell
136+
$webConfig.Properties.preWarmedInstanceCount = $webConfig.Properties.reservedInstanceCount
137+
$webConfig.Properties.reservedInstanceCount = $null
138+
$webConfig | Set-AzResource -ResourceId {resourceId}
139+
```
140+
141+
Error example:
142+
143+
```powershell
144+
Set-AzResource :
145+
{
146+
"Code":"BadRequest",
147+
"Message":"siteConfig.ReservedInstanceCount is invalid. Please use the new property siteConfig.PreWarmedInstanceCount.",
148+
"Target": null,
149+
"Details":
150+
[
151+
{
152+
"Message":"siteConfig.ReservedInstanceCount is invalid. Please use the new property siteConfig.PreWarmedInstanceCount."
153+
},
154+
{
155+
"Code":"BadRequest"
156+
},
157+
{
158+
"ErrorEntity":
159+
{
160+
"ExtendedCode":"51021",
161+
"MessageTemplate":"{0} is invalid. {1}",
162+
"Parameters":
163+
[
164+
"siteConfig.ReservedInstanceCount", "Please use the new property siteConfig.PreWarmedInstanceCount."
165+
],
166+
"Code":"BadRequest",
167+
"Message":"siteConfig.ReservedInstanceCount is invalid. Please use the new property siteConfig.PreWarmedInstanceCount."
168+
}
169+
}
170+
],
171+
"Innererror": null
172+
}
173+
```
174+
175+
## Prevent context loss during resource scale-in events
176+
177+
Resource scale-in events might cause the loss of context for built-in connectors with stateful mode enabled. To prevent this potential loss before such events can happen, fix the number of instances available for your logic app resource. This way, no scale-in events can happen to cause this potential context loss.
178+
179+
1. On your logic app resource menu, under **Settings**, select **Scale out**.
180+
181+
1. Under **App Scale Out**, set **Enforce Scale Out Limit** to **Yes**, which shows the **Maximum Scale Out Limit**.
182+
183+
1. On the **Scale out** page, under **App Scale out**, set the number for **Always Ready Instances** to the same number as **Maximum Scale Out Limit** and **Maximum Burst**, which appears under **Plan Scale Out**, for example:
184+
185+
:::image type="content" source="media/enable-stateful-affinity-built-in-connectors/scale-in-settings.png" alt-text="Screenshot shows Azure portal, Standard logic app resource, Scale out page, and Always Ready Instances number set to match Maximum Scale Out Limit and Maximum Burst.":::
186+
187+
1. When you're done, on the **Scale out** toolbar, select **Save**.
188+
189+
## Next steps
190+
191+
- [Connect to Azure Service Bus](connectors-create-api-servicebus.md)
192+
- [Connect to SAP](../logic-apps/logic-apps-using-sap-connector.md)
51.4 KB
Loading
61.8 KB
Loading

articles/logic-apps/logic-apps-using-sap-connector.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ The preview SAP built-in connector trigger named **Register SAP RFC server for t
129129
> When you use a Premium-level ISE, use the ISE-native SAP connector, not the SAP managed connector,
130130
> which doesn't natively run in an ISE. For more information, review the [ISE prerequisites](#ise-prerequisites).
131131
132+
* By default, the preview SAP built-in connector operations are stateless. To run these operations in stateful mode, see [Enable stateful mode for stateless built-in connectors](../connectors/enable-stateful-affinity-built-in-connectors.md).
133+
132134
* To use either the SAP managed connector trigger named **When a message is received from SAP** or the SAP built-in trigger named **Register SAP RFC server for trigger**, complete the following tasks:
133135

134136
* Set up your SAP gateway security permissions or Access Control List (ACL). In the **Gateway Monitor** (T-Code SMGW) dialog box, which shows the **secinfo** and **reginfo** files, open the **Goto** menu, and select **Expert Functions** > **External Security** > **Maintenance of ACL Files**.
@@ -492,7 +494,7 @@ For a Standard workflow in single-tenant Azure Logic Apps, use the preview SAP *
492494
- **sapnco.dll**
493495
- **sapnco_utils.dll**
494496
495-
1. To SNC from SAP, you need to download the following files and have them ready to upload to your logic app resource. For more information, see [SNC prerequisites](#snc-prerequisites-standard):
497+
1. For SNC from SAP, you need to download the following files and have them ready to upload to your logic app resource. For more information, see [SNC prerequisites](#snc-prerequisites-standard):
496498
497499
- **sapcrypto.dll**
498500
- **sapgenpse.exe**

articles/logic-apps/toc.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@
9696
href: ../connectors/compare-built-in-azure-connectors.md
9797
- name: Edit host and app settings for logic apps in single-tenant
9898
href: edit-app-settings-host-settings.md
99+
- name: Enable stateful mode for stateless built-in connectors
100+
href: ../connectors/enable-stateful-affinity-built-in-connectors.md
99101
- name: DevOps deployment for single-tenant
100102
href: devops-deployment-single-tenant-azure-logic-apps.md
101103
- name: Set up DevOps deployment for single-tenant
@@ -284,7 +286,7 @@
284286
href: logic-apps-enterprise-integration-liquid-transform.md
285287
- name: Troubleshoot B2B errors
286288
href: logic-apps-enterprise-integration-b2b-list-errors-solutions.md
287-
- name: Connectors - In-depth topics
289+
- name: Connectors - How-to guides
288290
items:
289291
- name: AS2
290292
href: logic-apps-enterprise-integration-as2.md

0 commit comments

Comments
 (0)