Cloud service · Azure · Updated

Azure Stream Analytics - Azure Stream Analytics is a fully managed stream-processing service that uses SQL-based queries to transform, aggregate, and analyze events as they arrive.

In short

Azure Stream Analytics processes continuous data from applications, devices, and event pipelines to produce time-windowed metrics, detect patterns, and enrich events with reference data. Engineers define jobs with inputs, queries, and outputs, then provision processing capacity without managing the underlying servers.

Cloud Services Hub →

9 key features of Azure Stream Analytics

01
SQL-based continuous processing

Define filtering, projections, aggregations, and stream correlations in a SQL-based query. A single job can route different query results to multiple outputs without a separate application for each transformation.

02
Event-time windows and temporal joins

Use tumbling, hopping, sliding, or session windows to calculate metrics over time. Assign event timestamps with TIMESTAMP BY and configure late-arrival and out-of-order handling to match the data's expected delivery behavior.

03
Reference-data enrichment

Join events with static or slowly changing reference data from Azure Blob Storage or Azure SQL Database. This supports lookups such as device ownership, product categories, and location-specific thresholds without querying an operational system for every event.

04
Native Azure connectors

Read from services such as Event Hubs and IoT Hub, then write to supported databases, event streams, and storage destinations. Configure connector authentication, serialization, and destination capacity as part of the job design.

05
Avro schema registry integration

Event Hubs inputs can retrieve Avro schema information from Azure Schema Registry for deserialization. This separates schema metadata from event payloads and reduces repeated schema overhead in messages.

06
Geospatial and anomaly analysis

Apply geospatial functions to scenarios such as geofencing, and use built-in anomaly-detection functions to identify spikes, dips, or changes in a stream. Tune detection settings against historical examples before connecting results to operational actions.

07
Managed recovery and scalable capacity

The service maintains checkpoints and replays retained input events when needed to rebuild state. Allocate streaming units and partition the query appropriately to support steady-state throughput and recovery catch-up.

08
Native Delta Lake output

Write streaming results directly to Delta Lake tables in append mode. The native connector supports exactly-once semantics for its output path, making it useful for continuously populated lakehouse tables.

09
Query development and extensibility

Develop with the Azure portal, Visual Studio Code, or the no-code editor, and deploy through automation tools such as Bicep or Terraform. Use supported JavaScript user-defined functions and aggregates when built-in expressions do not cover the required calculation.

Where Azure Stream Analytics is used

  1. 01
    Industrial telemetry monitoring

    Aggregate device readings by equipment and time window, enrich them with asset metadata, and emit threshold breaches or anomaly events. Send the results to an event stream for downstream notification or maintenance workflows.

  2. 02
    Streaming lakehouse ingestion

    Validate, filter, and normalize incoming events before writing them to Azure Data Lake Storage Gen2 or Delta Lake tables. Retain the resulting datasets for historical analysis, model development, and batch processing.

  3. 03
    Application and clickstream metrics

    Calculate request rates, error counts, page activity, or session-based behavior from application events. Store the aggregates in an analytical or operational database that dashboards can query.

  4. 04
    Time-bounded fraud indicators

    Correlate transactions or activity events within bounded time intervals to identify suspicious sequences, repeated attempts, or geographically inconsistent behavior. Publish indicators to downstream systems for further evaluation rather than treating every match as a confirmed incident.

  5. 05
    Fleet tracking and geofencing

    Evaluate location events against geographic reference data to detect entry into or departure from defined areas. Combine location results with vehicle metadata to support fleet monitoring and operational alerts.

  6. 06
    Operational database projections

    Transform raw events into compact records or windowed summaries for Azure SQL Database or Azure Cosmos DB. Design destination keys and write behavior to accommodate the selected connector's delivery guarantees.

How Azure Stream Analytics is priced

Provisioned job capacity

Cloud jobs are charged for allocated streaming-unit capacity over their running time, with rates depending on the selected offering and region. This is capacity-based billing rather than a per-event model, so a running job can incur compute charges even when input traffic is low.

Dedicated cluster capacity

Stream Analytics clusters provide dedicated processing capacity that can host multiple jobs. Billing is based on provisioned cluster capacity, so size and consolidate workloads carefully; an allocated cluster can incur charges even when its jobs are not processing events.

Connected-service and data-transfer charges

Budget separately for input brokers, output databases, storage capacity and transactions, monitoring, and applicable network transfer. Destination throughput and retention settings can materially affect the total pipeline cost.

Services Azure Stream Analytics works with

A common architecture places Azure Event Hubs or Azure IoT Hub in front of a Stream Analytics job to provide ingestion and buffering. The job parses events, applies event-time windows, and enriches records with reference data from Blob Storage or Azure SQL Database. Its outputs can separate operational reactions from long-term analytics: publish alert events to Event Hubs, write reporting records to SQL Database or Cosmos DB, and archive transformed data in Data Lake Storage Gen2.

For analytical workloads, write append-only Delta Lake tables for lakehouse consumption or send curated events to Azure Data Explorer for interactive investigation. These destinations serve different access patterns, so select them according to query latency, retention, and application requirements rather than treating them as interchangeable sinks.

Design the entire pipeline for recovery and backpressure. Preserve enough source history to rebuild state, monitor destination throttling, and use replay-safe writes where delivery can produce duplicates. Apply least-privilege access and managed identities where supported, and load-test both the processing job and its destinations under sustained traffic and recovery conditions.

Event Hubs

Use Event Hubs as a buffered streaming input or as an output for downstream consumers. For example, ingest application events, calculate per-minute error counts, and publish only threshold breaches to a separate event hub. Give independently consuming jobs separate consumer groups, size source retention for replay, and align partitioning with the query's parallelism. For Avro inputs, the job can retrieve schema information from Azure Schema Registry.

Azure IoT Hub

Read device-to-cloud telemetry through the IoT Hub input connector. For example, compute a five-minute average temperature per device and enrich it with asset thresholds before emitting an alert record. Validate timestamp quality and configure late-event handling for devices that buffer readings during connectivity interruptions.

Azure Data Lake Storage

Write transformed events to storage for durable retention and downstream analytics, or use Blob Storage to supply reference data. For example, archive cleaned telemetry as Parquet in Data Lake Storage Gen2 and query it later with a lake analytics engine. The native Delta Lake output provides an append-oriented path into Delta tables with connector-specific exactly-once semantics.

Azure SQL Database

Use Azure SQL Database as an output for relational reporting tables or as a source of slowly changing reference data. For example, join order events with a product reference dataset and write sales totals by store and time window into a reporting table. Provision enough database write capacity and design table keys around the required output and replay behavior.

Azure Cosmos DB

Write processed events or aggregate documents into Azure Cosmos DB for application access. For example, maintain device-summary documents that a monitoring application reads by device identifier. Choose partition keys and document identifiers carefully, and provision sufficient request-unit capacity to avoid output throttling.

Azure Data Explorer

Send filtered, enriched, or aggregated events to Azure Data Explorer for persistent storage and interactive analysis with Kusto Query Language. For example, detect unusual equipment readings in the stream and retain the relevant measurements in Data Explorer for incident investigation. Account for destination ingestion latency separately from the stream-processing latency.

Azure Blob Storage

Azure Stream Analytics can read event data and reference data from blobs and write query results back to Blob Storage. For example, a job can look up device metadata from a blob and archive the enriched telemetry in time-partitioned files.

Azure Container Instances

A Stream Analytics job can score incoming events through a built-in Azure Machine Learning function whose model is deployed on Azure Container Instances. This deployment option is supported when configuring the function in the Azure portal.

Azure Database for PostgreSQL

Azure Stream Analytics can write query results directly to a table in Azure Database for PostgreSQL Flexible Server. For example, a job can store per-minute event counts for an application to query.

Azure DevOps

Azure Stream Analytics provides build and test tooling for job projects that can run in Azure Pipelines. A pipeline can test streaming queries against sample events and deploy the job configuration to Azure after the tests pass.

Alternatives to Azure Stream Analytics in other clouds

AWS

Amazon Managed Service for Apache FlinkAmazon Managed Service for Apache Flink

Both services provide managed real-time stream processing for tasks such as time-windowed analytics and fraud detection. Amazon Managed Service for Apache Flink runs Flink applications in Java, Scala, Python, or SQL, while Azure Stream Analytics runs SQL-based jobs with JavaScript extensions.

Compare fact by fact
Azure Stream AnalyticsAmazon Managed Service for Apache Flink
Programming modelSQL jobs with JavaScript extensionsFlink apps: Java, Scala, Python, SQL
Capacity managementTeam allocates streaming unitsAutomatic scaling with workload
Compute billingAllocated units over job runtimeHourly rate based on peak KPUs

What is Azure Stream Analytics

2 min read

Azure Stream Analytics is a managed platform for continuous event processing. Its fundamental deployment unit is a job, which contains input definitions, a SQL-based query, and output definitions. A job can filter telemetry, normalize event structures, calculate rolling metrics, correlate streams, and send different results to multiple destinations. It is intended for processing data in motion rather than replacing a persistent database or an interactive analytics engine.

Common streaming inputs include Azure Event Hubs and Azure IoT Hub. Azure Storage can also supply input data, while Azure Blob Storage and Azure SQL Database support static or slowly changing reference datasets. For example, a job can join device readings with an equipment inventory to attach site identifiers and operating thresholds before calculating alerts. Built-in input formats include JSON, CSV, and Avro. Event Hubs inputs can retrieve Avro schemas from Azure Schema Registry, avoiding the need to embed complete schemas in every event.

The query language extends familiar SQL concepts with temporal operations. Tumbling, hopping, sliding, and session windows support different aggregation requirements, while time-bounded joins correlate related events across streams. Use TIMESTAMP BY when processing should follow a timestamp carried in the event rather than its arrival time. Configure late-arrival and out-of-order policies deliberately: accepting more delayed data can improve completeness but also delay results. Geospatial functions, anomaly-detection functions, and JavaScript extensions address more specialized processing requirements.

Capacity is allocated using streaming units. Throughput depends on event size, query complexity, state size, partitioning, and destination performance, not simply the number of events received. Align input partitions and query partitioning where possible, and load-test representative traffic before selecting capacity. Monitor streaming-unit utilization, watermark delay, backlogged input events, and input or output errors. An overloaded destination can create processing delays even when the query has sufficient compute capacity.

The service checkpoints processing state and can replay source events during recovery. Configure source retention to cover the longest stateful query window plus operational recovery margin. Exactly-once processing does not imply exactly-once delivery to every destination; delivery guarantees depend on the output connector and configuration. Where duplicates are possible, design downstream writes or consumers to tolerate replay.

Deploy jobs through infrastructure-as-code tools and test queries with representative sample events before releasing changes. Prefer managed identities where supported, and configure permissions separately for each input and output. New implementations should not use the retiring Power BI output connector: new customers have been blocked from creating jobs using it since October 31, 2024, and existing jobs using it are scheduled to stop on October 31, 2027. The retired .NET Standard user-defined functions and custom .NET deserializers should be replaced with supported alternatives such as JavaScript functions and built-in input formats.

Azure architecture icons are the property of Microsoft. BlowStack is not affiliated with or endorsed by Microsoft.

AWS architecture icons are the property of Amazon Web Services. BlowStack is not affiliated with or endorsed by AWS.