Notice: Azure Stream Analytics is being retired. Microsoft recommends Microsoft Fabric Real-Time Intelligence (Eventstream + KQL) for new streaming projects. Existing workloads should be migrated; for example, Stream Analytics jobs using the Power BI output connector will stop running after October 31, 2027.
Azure Stream Analytics on Microsoft Azure
What is Azure Stream Analytics?
Azure Stream Analytics is a serverless real-time analytics service for event streaming data. The service uses a SQL-like query language to filter, aggregate, transform, and route millions of events per second to various outputs (databases, data lakes, Power BI) with sub-second latency.
At its core, Stream Analytics is optimized for continuous query processing: you define a query (similar to SQL with streaming-specific extensions), connect inputs (Event Hubs, IoT Hub, Blob Storage) and outputs (SQL Database, Cosmos DB, Power BI, Synapse, Event Hubs), and Stream Analytics processes events continuously, around the clock. The query language supports windowing functions (tumbling, hopping, sliding, and session windows) for time-based aggregations, joins between streams and reference data, and user-defined functions (JavaScript, C#).
Stream Analytics scales automatically via Streaming Units (SUs), which represent compute resources. One SU processes roughly 1 MB/s of throughput. Jobs scale from 1 to 192 SUs (or higher via support request). Geo-redundant event replay enables recovery after failures without data loss. Built-in anomaly detection identifies spikes, dips, and trend changes in time series without custom ML models.
Typical Use Cases
IoT Telemetry Aggregation
IoT solutions aggregate millions of sensor data events per second using tumbling windows (for example, average temperature per 5-minute interval). Stream Analytics reads from IoT Hub, computes aggregates, and writes to Cosmos DB for visualization. Alerts are triggered via Event Hubs when thresholds are exceeded.
Real-Time Dashboards for Operations
Operations teams monitor business metrics in real time via Power BI dashboards. Stream Analytics aggregates clickstreams, orders, and app events and pushes them to Power BI streaming datasets. Dashboards update every second with minimal latency.
Fraud Detection with Pattern Matching
Financial services detect fraud through pattern matching over event streams. Stream Analytics joins transactions with geo-location reference data, identifies impossible travel patterns (a transaction in country A followed by one in country B within 10 minutes), and triggers alerts.
Log Analytics and Anomaly Detection
IT operations teams use Stream Analytics for log aggregation and anomaly detection. Logs from thousands of VMs flow into Event Hubs, Stream Analytics aggregates error rates per minute, and built-in anomaly detection flags spikes. Alerts are routed via Logic Apps to incident management tools.
Clickstream Analytics for Personalization
E-commerce sites analyze clickstreams in real time for product recommendations. Stream Analytics joins page views with user profiles, computes affinities, and updates a recommendation cache (Redis) so recommendations reflect user behavior within seconds.
Best Practices for Azure Stream Analytics
Optimize Query Performance
Use PARTITION BY for parallel processing on partitioned inputs (Event Hubs partitions). Avoid cross-partition joins, which hurt performance. Use reference data for lookups instead of stream joins. Test queries against sample data before deploying to production.
Choose the Right Windowing Functions
Tumbling windows for non-overlapping aggregations (for example, a 5-minute average). Hopping windows for overlapping windows (for example, a 5-minute window every 1 minute). Sliding windows for continuous evaluation. Session windows for event bursts with gaps (for example, user sessions with a 30-minute timeout).
Implement Error Handling
Configure the error policy (drop or retry). Log failed events to Blob Storage for replay. Use a dead-letter queue for permanent failures. Monitor job failures and resource metrics via Azure Monitor.
Scale with Streaming Units
Start with 3-6 SUs and monitor SU utilization. Increase SUs when utilization exceeds 80%. For high throughput (above 50 MB/s), use 48 or more SUs. Partition inputs for better parallelism.
Use Compatibility Level 1.2+
The newest compatibility levels offer better performance, JavaScript UDFs, and newer SQL features. Migrate older jobs to 1.2 for improved throughput and latency.
Frequently Asked Questions about Azure Stream Analytics
Is Azure Stream Analytics still available?
Azure Stream Analytics is being retired by Microsoft, which recommends Microsoft Fabric Real-Time Intelligence (Eventstream and KQL) for new streaming projects. Existing jobs continue to run for now, but specific connectors have announced retirement dates, so migration should be planned.
What is the difference from Apache Spark Streaming or Flink?
Stream Analytics is a serverless PaaS with a SQL interface, well-suited for business analysts and straightforward stream processing. Spark Streaming and Flink are more flexible (full programming languages) but require cluster management and developer skills. Choose Stream Analytics for SQL-based use cases, Spark or Flink for complex event-processing logic.
How do Streaming Units work?
A Streaming Unit (SU) combines compute, memory, and throughput capacity. One SU processes roughly 1 MB/s of input. Jobs scale from 1 to 192 SUs. Complex queries, joins, and aggregations require more SUs. Query tuning and partitioning improve SU efficiency.
Can I use custom code?
Yes, via JavaScript or C# user-defined functions (UDFs) and user-defined aggregates (UDAs). JavaScript UDFs run in-process with low latency; C# UDAs require compilation and deployment. Use UDFs for custom business logic that SQL cannot express, such as geo-distance calculations or custom hashing.
How does event ordering and late arrival work?
Stream Analytics orders events by event time (the timestamp in the event payload). Late arrival tolerance (configurable, for example 5 seconds) waits for delayed events. Out-of-order tolerance (for example 1 second) re-orders events. Events outside the configured tolerance are dropped or routed to a separate output.
What does Azure Stream Analytics cost?
Pricing is based on Streaming Units (SUs) billed per hour. Additional costs apply for inputs and outputs (Event Hubs, Storage). Pausing jobs during development and testing helps reduce costs. Exact prices are listed on the official Azure pricing page.
Does Stream Analytics support exactly-once processing?
Stream Analytics guarantees at-least-once delivery by default (events can be duplicated on retries). For exactly-once semantics, use Cosmos DB or SQL Database outputs with upsert (idempotent writes). Event Hubs output is at-least-once.
Integration with innFactory
As a Microsoft Solutions Partner, innFactory supports you in implementing real-time analytics with Azure Stream Analytics and in planning migrations to Microsoft Fabric Real-Time Intelligence. We help with query development, architecture design, and integration with IoT and event-driven systems.
Contact us for a non-binding consultation on Azure Stream Analytics, Microsoft Fabric Real-Time Intelligence, and stream processing.
Typical Use Cases
Technical Specifications
Note: All product information on this page has been compiled with care, but is provided without guarantee and may be outdated or incomplete. Cloud services evolve rapidly — features, pricing, SLAs, and availability change frequently. Authoritative and up-to-date information can only be found on the official product page of Azure (official documentation). This page does not represent an offer by Azure.
