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.
An Azure Resource Manager template is a JavaScript Object Notation (JSON) file that defines the infrastructure and configuration for your project. The template uses 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 opens in the Azure portal.
Prerequisites
To complete this article, you need to:
- Have an Azure subscription - create one for free.
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": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.26.54.24096",
"templateHash": "8637009133184248358"
}
},
"parameters": {
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for the resources."
}
},
"streamAnalyticsJobName": {
"type": "string",
"minLength": 3,
"maxLength": 63,
"metadata": {
"description": "Stream Analytics Job Name, can contain alphanumeric characters and hypen and must be 3-63 characters long"
}
},
"numberOfStreamingUnits": {
"type": "int",
"minValue": 3,
"maxValue": 660,
"metadata": {
"description": "You can choose the number of Streaming Units, ranging from 3, 7, 10, 20, 30, in multiples of 10, and continuing up to 660."
}
}
},
"resources": [
{
"type": "Microsoft.StreamAnalytics/streamingjobs",
"apiVersion": "2021-10-01-preview",
"name": "[parameters('streamAnalyticsJobName')]",
"location": "[parameters('location')]",
"properties": {
"sku": {
"name": "StandardV2"
},
"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]"
}
}
}
}
],
"outputs": {
"location": {
"type": "string",
"value": "[parameters('location')]"
},
"name": {
"type": "string",
"value": "[parameters('streamAnalyticsJobName')]"
},
"resourceGroupName": {
"type": "string",
"value": "[resourceGroup().name]"
},
"resourceId": {
"type": "string",
"value": "[resourceId('Microsoft.StreamAnalytics/streamingjobs', parameters('streamAnalyticsJobName'))]"
}
}
}
The Azure resource defined in the template is Microsoft.StreamAnalytics/StreamingJobs: creates an Azure Stream Analytics job.
Deploy the template
In this section, you create an Azure Stream Analytics job using the ARM template.
Select the following image to sign in to Azure and open a template. The template creates an Azure Stream Analytics job.
Provide the required values to create your Azure Stream Analytics job.
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. Select Review + Create, then Create.
Review deployed resources
You can either use the Azure portal to check the Azure Stream Analytics job or use Azure CLI or Azure PowerShell script to list the resource.
Azure portal
After the deployment completes, select Go to resource to navigate to the Stream Analytics Job page for the job.
Azure CLI
Use the az stream-analytics job show command to get details about the job you created. Replace placeholders with your Azure subscription ID, resource group name, and Stream Analytics job name.
az stream-analytics job show -s SUBSCRIPTIONID -g RESOURCEGROUPNAME -n ASAJOBNAME
Azure PowerShell
Use the Get-AzStreamAnalyticsJob command to get details about the job you created. Replace placeholders with your Azure subscription ID, resource group name, and Stream Analytics job name.
Get-AzStreamAnalyticsJob -SubscriptionID $subscriptionID -ResourceGroupName $resourceGroupName -Name $streamAnalyticsJobName
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
az group delete --name RESOURCEGROUPNAME
Azure PowerShell
Remove-AzResourceGroup -Name RESOURCEGROUPNAME
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.