Script icon
Docker icon
If icon
SlackIncomingWebhook icon
Log icon
Return icon
Schedule icon

Azure Front Door Origin Response Latency Sentinel

Audits Azure Front Door origin response latency and backend health probe statuses via Azure Monitor, dispatching diagnostic alerts to SRE teams on Slack.

Categories
CloudInfrastructure

Global enterprise applications rely on Azure Front Door as a cloud-scale Content Delivery Network (CDN) and Layer 7 reverse proxy. Azure Front Door routes incoming client requests across global POPs to backend origins such as App Services, Kubernetes clusters, and regional application gateways. When backend origins suffer from CPU exhaustion, database deadlocks, or misconfigured health probe endpoints, origin response latency spikes and health percentages plunge. If undetected, edge caching fails to mask origin latency and end-user request timeouts increase. This sentinel interrogates Azure Monitor metrics across configured Front Door profiles on a scheduled cadence, measures origin latency percentiles and health probe scores, and alerts SRE teams on Slack before end-user service levels deteriorate.

How it works

  1. Scheduled triggering: Executes every 15 minutes via automated cron trigger (*/15 * * * *) or triggers on-demand via manual execution.
  2. Resource target binding: Binds to the designated Azure Front Door Standard/Premium profile resource identifier in the specified subscription.
  3. Azure Monitor telemetry retrieval: Queries Azure Monitor metrics API for OriginLatency and OriginHealthPercentage over a 15-minute rolling window.
  4. SLA threshold evaluation: Evaluates average origin response latency against max_origin_latency_ms and checks for health probe drops.
  5. Conditional branching: An io.kestra.plugin.core.flow.If task evaluates whether origin latency or health breaches require intervention.
  6. Slack incident dispatch: Emits rich incident cards to #azure-alerts detailing profile names, resource groups, observed latency in milliseconds, and CLI diagnostic commands.
  7. Audit trail logging and return: Logs operational telemetry and returns a diagnostic JSON manifest for site reliability engineers.

Architecture diagram

flowchart TD
  A[scheduled_frontdoor_audit Schedule Trigger] --> B[scan_frontdoor_origin_telemetry Python Script]
  B --> C[check_origin_latency Flowable If]
  C -- Origin Degraded --> D[notify_slack_origin_latency Webhook]
  C -- Origin Healthy --> E[log_frontdoor_status Log]
  D --> E
  E --> F[export_frontdoor_manifest Return]

Use cases

  • Global origin degradation detection: Alert cloud infrastructure teams when backend microservices experience latency spikes behind Azure Front Door.
  • Health probe failure isolation: Detect origin health probe timeouts before Front Door removes origins from the active rotation pool.
  • Multi-region traffic shift verification: Verify that secondary disaster recovery origins remain warm and respond within acceptable latency thresholds.

Inputs

Name Type Default Description
azure_subscription_id STRING 00000000-0000-0000-0000-000000000000 Target Azure subscription ID hosting the Azure Front Door profile.
resource_group_name STRING production-rg Name of the Azure resource group containing the Front Door profile.
frontdoor_profile_name STRING prod-global-frontdoor Name of the Azure Front Door Standard/Premium profile to audit.
max_origin_latency_ms INT 1200 Maximum allowable origin response latency in milliseconds before triggering performance alerts.
alert_on_latency BOOL true Whether to dispatch automated Slack incident notifications when origin degradation is detected.

Expected outputs

  • {{ outputs.scan_frontdoor_origin_telemetry.vars.origins_audited_count }}: Number of Front Door profiles evaluated during the audit.
  • {{ outputs.scan_frontdoor_origin_telemetry.vars.degraded_origins_count }}: Number of profiles exhibiting origin latency or health degradations.
  • {{ outputs.scan_frontdoor_origin_telemetry.vars.degraded_origins_details }}: Serialized JSON array of degraded origins with latency metrics.
  • {{ outputs.export_frontdoor_manifest.value }}: Structured dictionary containing the consolidated Front Door performance report.

Prerequisites

  • Outbound HTTPS network access from Kestra execution workers to Azure Resource Manager and Azure Monitor endpoints.
  • Azure Service Principal credentials configured with Monitoring Reader role on the Front Door resource group.
  • Slack incoming webhook endpoint configured for Azure infrastructure alerting.

Secrets

  • AZURE_CLIENT_ID: Azure Service Principal Application (Client) ID.
  • AZURE_CLIENT_SECRET: Azure Service Principal client secret credential.
  • AZURE_TENANT_ID: Azure Directory (Tenant) ID.
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook URL used to dispatch incident notifications.

Quick start

  1. Define AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, AZURE_TENANT_ID, and SLACK_WEBHOOK_URL in your Kestra Secret storage.
  2. Import this workflow into your Kestra instance under the company.cloud namespace.
  3. Configure azure_subscription_id, resource_group_name, and frontdoor_profile_name to match your environment.
  4. Run a manual execution to test Azure Monitor metric extraction and verify Slack incident broadcasting.

Common pitfalls and troubleshooting

  • Resource ID casing: Azure Resource IDs are case-sensitive in API queries; ensure provider names and resource types follow standard casing conventions.
  • Aggregation intervals: Azure Front Door metrics are aggregated at 1-minute and 5-minute intervals; ensure timespan windows span at least 15 minutes.
  • Role assignment scope: Ensure the service principal has Reader and Monitoring Reader roles on the specific Front Door resource or its resource group.

How to extend

  • Automated origin disablement: Add an automated step to temporarily disable degraded origins using az afd origin update --enabled-state Disabled.
  • PagerDuty on-call escalation: Escalate critical global CDN origin failures directly to on-call site reliability engineers via PagerDuty.
  • Synthetic origin probe test: Execute synthetic curl health checks directly against backend origin hostnames to bypass edge caching during incident investigations.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.