|
| 1 | +--- |
| 2 | +title: Quickstart - Create an Azure Stream Analytics job using Bicep |
| 3 | +description: This quickstart shows how to use Bicep to create an Azure Stream Analytics job. |
| 4 | +ms.service: stream-analytics |
| 5 | +author: schaffererin |
| 6 | +ms.author: v-eschaffer |
| 7 | +ms.workload: big-data |
| 8 | +ms.topic: quickstart |
| 9 | +ms.custom: mvc, subject-armqs, devx-track-azurepowershell, mode-arm |
| 10 | +ms.date: 05/17/2022 |
| 11 | +--- |
| 12 | + |
| 13 | +# Quickstart: Create an Azure Stream Analytics job using Bicep |
| 14 | + |
| 15 | +In this quickstart, you use Bicep to create an Azure Stream Analytics job. Once the job is created, you validate the deployment. |
| 16 | + |
| 17 | +[!INCLUDE [About Bicep](../../includes/resource-manager-quickstart-bicep-introduction.md)] |
| 18 | + |
| 19 | +## Prerequisites |
| 20 | + |
| 21 | +To complete this article, you need to have an Azure subscription. [Create one for free](https://azure.microsoft.com/free/). |
| 22 | + |
| 23 | +## Review the Bicep file |
| 24 | + |
| 25 | +The Bicep file used in this quickstart is from [Azure Quickstart Templates](https://azure.microsoft.com/resources/templates/streamanalytics-create/). |
| 26 | + |
| 27 | +:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.streamanalytics/streamanalytics-create/main.bicep"::: |
| 28 | + |
| 29 | +The Azure resource defined in the Bicep file is [Microsoft.StreamAnalytics/StreamingJobs](/azure/templates/microsoft.streamanalytics/streamingjobs): create an Azure Stream Analytics job. |
| 30 | + |
| 31 | +## Deploy the Bicep file |
| 32 | + |
| 33 | +1. Save the Bicep file as **main.bicep** to your local computer. |
| 34 | +1. Deploy the Bicep file using either Azure CLI or Azure PowerShell. |
| 35 | + |
| 36 | + # [CLI](#tab/CLI) |
| 37 | + |
| 38 | + ```azurecli |
| 39 | + az group create --name exampleRG --location eastus |
| 40 | + az deployment group create --resource-group exampleRG --template-file main.bicep --parameters streamAnalyticsJobName =<job-name> numberOfStreamingUnits=<int> |
| 41 | + ``` |
| 42 | +
|
| 43 | + # [PowerShell](#tab/PowerShell) |
| 44 | +
|
| 45 | + ```azurepowershell |
| 46 | + New-AzResourceGroup -Name exampleRG -Location eastus |
| 47 | + New-AzResourceGroupDeployment -ResourceGroupName exampleRG -TemplateFile ./main.bicep -streamAnalyticsJobName "<job-name>" -numberOfStreamingUnits <int> |
| 48 | + ``` |
| 49 | +
|
| 50 | + --- |
| 51 | +
|
| 52 | + You need to provide values for the following parameters: |
| 53 | +
|
| 54 | + - **streamAnalyticsJobName**: Replace **\<job-name\>** with the Stream Analytics job name. The name can contain alphanumeric characters and hyphens, and it must be at least 3-63 characters long. |
| 55 | + - **numberOfStreamingUnits**: Replace **\<int\>** with the number of Streaming Units. Allowed values include: 1, 3, 6, 12, 18, 24, 30, 36, 42, and 48. |
| 56 | +
|
| 57 | + > [!NOTE] |
| 58 | + > When the deployment finishes, you should see a message indicating the deployment succeeded. |
| 59 | +
|
| 60 | +## Review deployed resources |
| 61 | +
|
| 62 | +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. |
| 63 | +
|
| 64 | +### Azure CLI |
| 65 | +
|
| 66 | +Use the Azure portal, Azure CLI, or Azure PowerShell to list the deployed resources in the resource group. |
| 67 | +
|
| 68 | +# [CLI](#tab/CLI) |
| 69 | +
|
| 70 | +```azurecli-interactive |
| 71 | +az resource list --resource-group exampleRG |
| 72 | +``` |
| 73 | + |
| 74 | +# [PowerShell](#tab/PowerShell) |
| 75 | + |
| 76 | +```azurepowershell-interactive |
| 77 | +Get-AzResource -ResourceGroupName exampleRG |
| 78 | +``` |
| 79 | + |
| 80 | +--- |
| 81 | + |
| 82 | +## Clean up resources |
| 83 | + |
| 84 | +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: |
| 85 | + |
| 86 | +# [CLI](#tab/CLI) |
| 87 | + |
| 88 | +```azurecli-interactive |
| 89 | +az group delete --name exampleRG |
| 90 | +``` |
| 91 | + |
| 92 | +# [PowerShell](#tab/PowerShell) |
| 93 | + |
| 94 | +```azurepowershell-interactive |
| 95 | +Remove-AzResourceGroup -Name exampleRG |
| 96 | +``` |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +## Next steps |
| 101 | + |
| 102 | +In this quickstart, you created an Azure Stream Analytics job using Bicep and validated the deployment. To learn how to create your own Bicep files using Visual Studio Code, continue on to the following article: |
| 103 | + |
| 104 | +> [!div class="nextstepaction"] |
| 105 | +> [Quickstart: Create Bicep files with Visual Studio Code](../azure-resource-manager/bicep/quickstart-create-bicep-use-visual-studio-code.md) |
0 commit comments