July 7, 2021 - iot dapr

Internet of Things (IoT) on-edge with Logic Apps and Dapr

Xavier Geerinck

@XavierGeerinck

Did you enjoy reading? Or do you want to stay up-to-date of new Articles?

Consider sponsoring me or providing feedback so I can continue creating high-quality articles!

TODO TODO TODO

For a customer, I have been researching a way to reduce the time it takes us to integrate different sensors on-edge, while still being flexible and configure everything remotely. Next to that, we do not want to spend much time on integrating custom connectors.

Use Case: "Reduce the time it takes us to integrate different sensors on-edge"

Requirements

  • Support on-edge flows with a focus on
    • Protocols (MQTT, AMQP, Websockets, Webhooks are commonly used by sensor vendors)
    • On-Edge computation (AI Inferencing)
  • Offline support (cloud connection should be optional)
  • Possible connectors for multi-cloud support (some of our customers require this)

Meet Logic Apps Standard

One of the possible solutions that caught my eye is Logic Apps. Now you might wonder: "Doesn't Logic App require an Azure Connection?" Well this was true until BUILD 2021 that introduced Logic Apps Standard which is a SKU designed to run as a containerized workload that can run anywhere.

Making Logic Apps Standard Available Offline

If you have worked with Logic Apps before, you will know that Logic Apps is quite dependent on Azure Storage for its AzureWebJobsStorage setting, which uses this connection string for normal operation. This is an Azure connection string or an Azure Storage Emulator connection string. It's thus not a good solution to work offline.

Luckily for us, Microsoft also announced that they are working on SQL Support to enable workloads to run locally with no Azure dependency on storage❗ Which is available as a Private Preview, so sign-up to get a sneak peek at it! 😉

For my use case I requested access to it and wanted to show you how this works!

Creating a Logic Apps Workflow

Requirements

Before we can get started creating our Logic Apps workflow, we need to install some dependencies:

⚠ I ran this on Windows where I had access to Winget for easy installation

  1. Install .NET Core SDK (winget install Microsoft.dotnet --version 3.1.409)
  1. Install Azure Functions Core Tools (winget install Microsoft.AzureFunctionsCoreTools)
  2. Install VSCode Extension - Azure Logic Apps (Standard)
  3. Install VSCode Extension - Azure Functions
  4. Create global.json file in the root folder to configure the dotnet version it should use with the content below

global.json

{
"sdk": {
"version": "3.1.409",
"rollForward": "disable"
}
}

Configure SQL Storage Provider for Logic Apps

Now we have all our dependencies installed, we can continue setting up the Storage Provider we will use. In this case that will be the SQL Storage Provider (Private Preview).

Of course we need a SQL Server instance running for our SQL Storage Provider. For development purposes, we can simply run this with:

docker run -e 'ACCEPT_EULA=Y' -e '[email protected]' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2019-CU11-ubuntu-20.04

Which will allow us to connect through tools such as Azure Data Studio.

Create a database here and shape it into a connection string

# Create Database Query:
CREATE DATABASE LogicAppDemo
# Example Connection String:
Server=localhost\\SQLEXPRESS;Database=LogicAppDemo;Integrated Security=True;

Did you enjoy reading? Or do you want to stay up-to-date of new Articles?

Consider sponsoring me or providing feedback so I can continue creating high-quality articles!

Xavier Geerinck © 2020

Twitter - LinkedIn