Quickstart: Create an Azure Stream Analytics job by using an ARM template

In this quickstart, you use an Azure Resource Manager template (ARM template) to create an Azure Stream Analytics job. Once the job is created, you validate the deployment.

A resource manager template is a JavaScript Object Notation (JSON) file that defines the infrastructure and configuration for your project. The template uses declarative syntax. In declarative syntax, you describe your intended deployment without writing the sequence of programming commands to create the deployment.

If your environment meets the prerequisites and you're familiar with using ARM templates, select the Deploy to Azure button. The template will open in the Azure portal.

Deploy to Azure


To complete this article, you need to:

Review the template

The template used in this quickstart is from Azure Quickstart Templates.

  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "",
  "metadata": {
    "_generator": {
      "name": "bicep",
      "version": "",
      "templateHash": "10972314977021709659"
  "parameters": {
    "location": {
      "type": "string",
      "defaultValue": "[resourceGroup().location]",
      "metadata": {
        "description": "Location for the resources."
    "streamAnalyticsJobName": {
      "type": "string",
      "maxLength": 63,
      "minLength": 3,
      "metadata": {
        "description": "Stream Analytics Job Name, can contain alphanumeric characters and hypen and must be 3-63 characters long"
    "numberOfStreamingUnits": {
      "type": "int",
      "allowedValues": [
      "maxValue": 48,
      "minValue": 1,
      "metadata": {
        "description": "Number of Streaming Units"
  "resources": [
      "type": "Microsoft.StreamAnalytics/streamingjobs",
      "apiVersion": "2021-10-01-preview",
      "name": "[parameters('streamAnalyticsJobName')]",
      "location": "[parameters('location')]",
      "properties": {
        "sku": {
          "name": "Standard"
        "outputErrorPolicy": "Stop",
        "eventsOutOfOrderPolicy": "Adjust",
        "eventsOutOfOrderMaxDelayInSeconds": 0,
        "eventsLateArrivalMaxDelayInSeconds": 5,
        "dataLocale": "en-US",
        "transformation": {
          "name": "Transformation",
          "properties": {
            "streamingUnits": "[parameters('numberOfStreamingUnits')]",
            "query": "SELECT\r\n    *\r\nINTO\r\n    [YourOutputAlias]\r\nFROM\r\n    [YourInputAlias]"

The Azure resource defined in the template is Microsoft.StreamAnalytics/StreamingJobs: create an Azure Stream Analytics job.

Deploy the template

In this section, you create an Azure Stream Analytics job using the ARM template.

  1. Select the following image to sign in to Azure and open a template. The template creates an Azure Stream Analytics job.

    Deploy to Azure

  2. Provide the required values to create your Azure Stream Analytics job.

    Create Azure Stream Analytics job using an Azure Resource Manager template

    Provide the following values:

    Property Description
    Subscription From the drop-down, select your Azure subscription.
    Resource group Specify whether you want to create a new resource group or use an existing one. A resource group is a container that holds related resources for an Azure solution. For more information, see Azure Resource Group overview.
    Region Select East US. For other available regions, see Azure services available by region.
    Stream Analytics Job Name Provide a name for your Stream Analytics job.
    Number of Streaming Units Choose the number of streaming units you need. For more information, see Understand and adjust Streaming Units.
  3. Select Review + Create, then Create.

Review deployed resources

You can either use the Azure portal to check the Azure Stream Analytics job or use the following Azure CLI or Azure PowerShell script to list the resource.

Azure CLI

echo "Enter your Azure Stream Analytics job name:" &&
read streamAnalyticsJobName &&
echo "Enter the resource group where the Azure Stream Analytics job exists:" &&
read resourcegroupName &&
az stream-analytics job show -g $resourcegroupName -n $streamAnalyticsJobName

Azure PowerShell

$resourceGroupName = Read-Host -Prompt "Enter the resource group name where your Azure Stream Analytics job exists"
(Get-AzResource -ResourceType "Microsoft.StreamAnalytics/StreamingJobs" -ResourceGroupName $resourceGroupName).Name
 Write-Host "Press [ENTER] to continue..."

Clean up resources

If you plan to continue on to subsequent tutorials, you may wish to leave these resources in place. When no longer needed, delete the resource group, which deletes the Azure Stream Analytics job. To delete the resource group by using Azure CLI or Azure PowerShell:

Azure CLI

echo "Enter the Resource Group name:" &&
read resourceGroupName &&
az group delete --name $resourceGroupName &&
echo "Press [ENTER] to continue ..."

Azure PowerShell

$resourceGroupName = Read-Host -Prompt "Enter the Resource Group name"
Remove-AzResourceGroup -Name $resourceGroupName
Write-Host "Press [ENTER] to continue..."

Next steps

In this quickstart, you created an Azure Stream Analytics job by using an ARM template and validated the deployment. Advance to the next article to learn how to export an ARM template for an existing job using VS Code.