New to Kestra?
Use blueprints to kickstart your first workflows.
Audits Azure App Service Plans via Azure Monitor to detect memory saturation and container restart loops, alerting SRE teams via Slack.
Enterprise web portals, API gateways, and microservices hosted on Microsoft Azure depend on Azure App Service Plans to provide managed compute instances (server farms) that execute containerized applications and native runtimes (.NET, Java, Node.js, Python). When application code develops gradual memory leaks, unclosed database connection objects accumulate, or high-throughput file upload buffering exhausts system RAM, the underlying App Service worker instance approaches 100% memory utilization. In response, Azure App Service container orchestrators forcibly recycle worker processes, causing dropped in-flight HTTP requests, session disconnections, and cold-start latency surges. This sentinel interrogates the Azure Monitor Metrics API on a 10-minute cadence, inspects MemoryPercentage and CpuPercentage across worker instances, flags plans exceeding 85% memory consumption, and delivers actionable incident runbooks to SRE teams on Slack before out-of-memory recycling crashes production apps.
*/10 * * * *) or runs on-demand via manual execution.Microsoft.Web/serverfarms).MemoryPercentage and CpuPercentage metrics across a 15-minute rolling lookback window.max_memory_percent_threshold.io.kestra.plugin.core.flow.If flowable checks if memory is saturated and dispatches an alert card to #azure-compute-alerts.flowchart TD
A[ten_minute_appservice_audit Schedule Trigger] --> B[scan_appservice_memory Python Script]
B --> C[check_memory_saturation Flowable If]
C -- Memory Saturated --> D[notify_slack_memory_saturation Webhook]
C -- Compute Nominal --> E[log_compute_health_state Log]
D --> E
E --> F[export_appservice_manifest Return]
While Azure Monitor captures basic metric trends, integrating memory exhaustion alerts into cross-platform incident response channels requires workflow automation. Kestra connects directly to Azure APIs, evaluates custom operational thresholds, formats rich diagnostic cards with scaling guidance, and can trigger automated scale-out workflows. With Kestra's containerized Python runner and native secret management, teams maintain robust cloud compute guardrails without deploying third-party agent daemons.
| Name | Type | Default | Description |
|---|---|---|---|
azure_subscription_id |
STRING |
12345678-1234-1234-1234-123456789abc |
Azure subscription identifier containing the App Service Plan. |
resource_group_name |
STRING |
rg-production-apps |
Name of the Azure Resource Group hosting the App Service Plan. |
app_service_plan_name |
STRING |
asp-ecommerce-prod |
Name of the target Azure App Service Plan to audit for memory saturation. |
max_memory_percent_threshold |
FLOAT |
85.0 |
Maximum acceptable memory utilization percentage before triggering exhaustion alerts. |
alert_on_saturation |
BOOL |
true |
Whether to dispatch automated Slack alerts when App Service Plan memory is saturated. |
{{ outputs.scan_appservice_memory.vars.plan_name }}: Name of the evaluated App Service Plan.{{ outputs.scan_appservice_memory.vars.max_memory_percent }}: Maximum recorded memory utilization percentage.{{ outputs.scan_appservice_memory.vars.is_saturated }}: Boolean flag indicating whether memory utilization breached safety limits.{{ outputs.export_appservice_manifest.value }}: Structured dictionary containing the consolidated App Service diagnostic manifest.management.azure.com).Monitoring Reader permissions on the target resource group.AZURE_CLIENT_ID: Service Principal Application (Client) ID.AZURE_CLIENT_SECRET: Service Principal Secret.AZURE_TENANT_ID: Azure Active Directory Directory (Tenant) ID.SLACK_WEBHOOK_URL: Slack Incoming Webhook URL used to dispatch compute alerts.AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, AZURE_TENANT_ID, and SLACK_WEBHOOK_URL in your Kestra secret storage.company.cloud namespace.azure_subscription_id, resource_group_name, and app_service_plan_name with your App Service Plan details.Microsoft.Web/serverfarms for aggregate plan metrics rather than individual Microsoft.Web/sites.Maximum to catch peak instance memory spikes across all scaled-out instances.Monitoring Reader or Contributor on the hosting resource group.io.kestra.plugin.core.flow.ForEach loop to scan all App Service Plans across production environments.