Build a Low-Code Automation Platform with .NET 8, Elsa Workflows and Azure

Mahmut Sarıkaya 4 dk okuma 7 Görüntülenme 0
Build a Low-Code Automation Platform with .NET 8, Elsa Workflows and Azure

Why low-code automation matters today

Enterprises lose up to 30% of productivity when developers spend weeks building repetitive approval loops. A low-code workflow engine can cut that time to hours, allowing business analysts to design processes visually while developers focus on core logic.

System requirements and Azure preparation

Before writing code, verify that your development machine runs Windows 11 or a recent Linux distribution with .NET 8 SDK installed. Azure subscription must have permission to create an App Service plan, a PostgreSQL flexible server (Elsa stores state in a relational database), and a resource group.

Typical Azure CLI steps look like this:

az group create --name wf-demo-rg --location eastus
az appservice plan create --name wf-plan --resource-group wf-demo-rg --sku B1
az webapp create --name wf-demo-app --resource-group wf-demo-rg --plan wf-plan --runtime "DOTNET|8.0"
az postgres flexible-server create --name wf-db --resource-group wf-demo-rg --location eastus --admin-user adminuser --admin-password MyStrongP@ssw0rd --sku Standard_D2s_v3

Store the connection string in the App Service settings under ConnectionStrings:Elsa for later use.

Creating a .NET 8 Web API project

Open a terminal, navigate to your development folder, and scaffold a minimal API project that targets .NET 8. The template includes Swagger, which is handy for testing workflow endpoints.

dotnet new webapi -n WorkflowPlatform -f net8.0

Change directory into WorkflowPlatform and commit the initial state to source control – Azure DevOps or GitHub Actions can automate the next deployment steps.

Adding Elsa Workflows packages

Elsa 2.x supports .NET 8 out of the box. The core package provides the runtime, while the Elsa.Workflows.Http extension enables HTTP triggers, perfect for low-code portals.

dotnet add package Elsa.Workflows --version 2.4.0
dotnet add package Elsa.Workflows.Http --version 2.4.0
dotnet add package Elsa.Persistence.EntityFrameworkCore.PostgreSql --version 2.4.0

These packages pull in EF Core, so the later migration step will generate the tables needed for workflow instances, definitions, and execution logs.

Configuring Elsa services in Program.cs

Replace the default builder code with the following snippet. It registers Elsa, connects to PostgreSQL, and activates the HTTP activity that lets non‑technical users start a workflow via a simple POST request.

using Elsa\Workflows;
using Elsa\Workflows.Http;
using Elsa\Persistence\EntityFrameworkCore;
using Elsa\Persistence\EntityFrameworkCore\PostgreSql;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddElsa(elsa => {
elsa.UseEntityFrameworkPersistence(ef => {
ef.UsePostgreSql(builder.Configuration.GetConnectionString("Elsa"));
});
elsa.AddHttpActivities();
elsa.UseWorkflowManagement();
});
var app = builder.Build();
app.UseRouting();
app.UseEndpoints(endpoints => {
endpoints.MapControllers();
endpoints.MapWorkflows(); // exposes /workflows endpoint
});
app.Run();

Notice the use of MapWorkflows() – it automatically registers the HTTP endpoint that the low‑code designer will call.

Defining a simple approval workflow with the visual designer

Elsa ships with a web‑based designer that can be hosted inside the same App Service. After publishing, navigate to /designer and drag a Http Trigger, a Run Script activity, and a Send Email activity. Set the trigger’s path to /api/approval/start and map the incoming JSON payload to workflow variables.

When a business user posts:

{ "requestId": "REQ-2024-001", "approver": "alice@example.com", "amount": 12500 }

the workflow stores the request, runs a small C# script to evaluate the amount, and sends an approval email if the threshold exceeds $10,000. The whole process runs without a single line of custom C# code beyond the script snippet.

Deploying to Azure App Service

Publish the application from the command line. The --configuration Release flag ensures the compiled binaries are optimized for production.

dotnet publish -c Release -o ./publish
az webapp deploy --resource-group wf-demo-rg --name wf-demo-app --src-path ./publish --type zip

Azure automatically scales the App Service plan based on CPU usage. For a low‑code platform, the typical load is under 200 requests per minute, which fits comfortably within the B1 tier.

Monitoring workflow orchestration

Elsa writes execution logs to the same PostgreSQL database. Azure Monitor can be configured to pull metrics from the database and generate alerts when a workflow fails more than three times in a row. Combine this with Application Insights for end‑to‑end tracing of HTTP requests.

Sample Kusto query to spot failing instances:

customEvents
| where name == "Elsa.WorkflowFailed"
| summarize count() by bin(timestamp, 5m), workflowName

Setting up a dashboard in Azure Portal gives business owners real‑time visibility without involving the development team.

Best practices for a maintainable low‑code platform

1. Version workflow definitions in source control – export the JSON representation after each design iteration.
2. Use feature flags in Azure App Configuration to toggle experimental activities without redeploying.
3. Limit script execution time to 5 seconds via Elsa settings to avoid runaway CPU usage.

Following these patterns keeps the platform agile while preserving the reliability expected from enterprise‑grade services.

Sources

  • Microsoft Docs – .NET 8 SDK installation guide
  • Elsa Workflows official documentation (v2.x)
  • Azure CLI reference – az webapp deploy

Author: Mahmut Sarıkaya — sarikayadev.com

Etiketler: #.NET 8 #Elsa Workflows #low-code automation #Azure App Service #workflow orchestration
Paylaş:
M

Yazar

Mahmut Sarıkaya

yazılım Geliştirici

Yorumlar

Henüz yorum yok. İlk yorumu siz yapın!

Yorum Bırakın

4 + 3 =