Running a Single Instance of a Azure Logic App

In certain scenarios you want to run a Single Instance off a Azure Logic App every time. Scenarios were you need this is when containers are created within your flow and the other messages are also depending on the same containers.

Solution

Together with a colleague of mine we searched for a solution and finally found the answer after having contact with Microsoft. The trigger component within a Logic App has a property called “operationOptions”. This property can be set to “SingleInstance” this will make sure the Logic App will only be trigged per message.

Example

"triggers": {
  "When_a_message_is_received_in_a_topic_subscription": {
    "type": "ApiConnection",
    "inputs": {
      "host": {
        "api": {
          "runtimeUrl": "https://logic-apis-westeurope.azure-apim.net/apim/servicebus"
        },
        "connection": {
          "name": "[name]"
        }
      },
      "method": "get",
      "path": "[path]"
    },
    "operationOptions": "SingleInstance",
    "recurrence": {
      "interval": 1,
      "frequency": "Minute"
    }
  }
}

The code snip-it above is a Service Bus trigger for new messages within a topic. By adding the “operationsOptions” this Logic App will only be triggered once per message.

Disadvantage

When using the “operationsOptions” property you have to keep in mind that only one instance will run within your interval. For example when there are 5 messages within the topic, and the Logic App is triggered once every minute it will get one message from the topic every minute and will not run a new flow if the preceding message is processed. In this example it will take about 5 minutes to process the 5 messages depending on how long your Logic Apps runs.

Related Posts

Azure Managed Service Identity and Local Development Instead of storing user credentials of an external system in a configuration file, you should store them in the Azure Key Vault. Before MSI (Managed S...
The securitydata Azure resource group Most of the times companies have rules in place for managing their Azure environment. The main rules that should be in place are “Azure Policies” and ...
Point to Site VPN Client won’t install To connect an Azure App Service to a on-premise database you can make use of different solutions. Two of those solutions are: Hybrid Connection ...
Invoke Azure Function in your Visual Studio Team Services CI/CD pipeline A utility task is available for Visual Studio Team Services (VSTS) to invoke an http triggered Azure function. The ability to invoke a Function from y...
VSTS Extension for Azure Role Based Access Control Today I published an extension for Visual Studio Team Services (VSTS) that gives you the ability to add and remove role based access assignments in Az...
Listing Azure Services within a CSV file In some situations you will look into a current Azure Environment and the setup/governance of it and need to migrate or move resources around. The ...

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.