• <1 minute

Supercharge your Azure Stream Analytics queries with C# code

Azure Stream Analytics is Microsoft’s serverless real-time analytics offering for complex event processing. It enables customers to unlock valuable insights and gain a competitive advantage by harnessing the power of big data.

Azure Stream Analytics (ASA) is Microsoft’s fully managed real-time analytics offering for complex event processing. It enables customers to unlock valuable insights and gain a competitive advantage by harnessing the power of big data.

Our customers love the simple SQL based query language that has been augmented with powerful temporal functions to analyze fast-moving event streams. The ASA query language natively supports complex geo-spatial functions, aggregation functions, and math functions. However, in many advanced scenarios, developers may want to reuse C# code and existing libraries instead of writing long queries for simple operations.

At Microsoft Ignite 2018, we announced a new feature that allows developers to extend the ASA query language with C# code. Currently, this capability is available for Stream Analytics jobs running on Azure IoT Edge (public preview). In many scenarios, it is more efficient to write C# code to perform some operations. In such cases, instead of being constrained by the SQL-like language, you can author a C# function and invoke it directly from the ASA query! Even better, you can use the ASA tools for Visual Studio to get native C# authoring and debugging experience.

Writing your own functions is most useful for scenarios like:

  • Building your own machine learning models in ML.NET, and using it for inference at the Edge.
  • Reusing custom library or Nuget to integrate existing code.
  • Converting data from one format to another. For example, binary-to-hex.
  • Parsing complex nested JSON structures.
  • Performing complex mathematical computations.
  • Using regular expressions and manipulating strings.
  • Converting timestamp between time zones.

Our vision with Azure Stream Analytics is to simplify real-time analytics on big data. And, this feature is one huge step towards improving developer productivity. Instead of stretching the query language to its limits and in a way that is unnatural given what SQL is meant to do, you can now focus on what is most important to your business such as getting your analytics pipeline running at scale with the power of Azure.

Writing your own C# function is easy

Within five minutes you can create your first C# function and use it in a Stream Analytics query by following this tutorial. Also, note that you can author JavaScript functions and use them for your ASA jobs running on the cloud.

Did you know we have more than ten new features in preview ready for you to try out? Sign up for our preview programs.

There is a strong, growing developer community that supports Stream Analytics. We, at Microsoft, are committed to improving Stream Analytics and are always listening for your feedback to improve our product! Follow us @AzureStreaming to stay updated on the latest features.