Edit

Share via


Deploy Stream Analytics jobs with Bicep files

The Azure Stream Analytics (ASA) CI/CD npm package allows you to build, test, and deploy your Stream Analytics projects in your CI/CD pipeline using Bicep files. This article walks you through how to generate bicep files and deploy your ASA jobs.

Follow this guide to create a new Stream Analytics project using Visual Studio Code or export an existing one from the Azure portal.

Installation

npm install -g azure-streamanalytics-cicd

Build project with Bicep

# Generate Bicep file
azure-streamanalytics-cicd build --v2 --project <projectFullPath> [--outputPath <outputPath>] --type Bicep

# Example: 
azure-streamanalytics-cicd build --v2 --project ./asaproj.json --outputPath ./Deploy --type Bicep

The build command does a keyword syntax check and generates Bicep files. If the project is built successfully, you see two files created under the output folder:

  • Bicep file: [ProjectName].JobTemplate.bicep
  • Bicep parameter file: [ProjectName].JobTemplate.bicep.parameters.json

The default values for parameters.json file come from your project settings. If you want to deploy to another environment, replace the values accordingly.

The default values for all credentials are null. You're required to set the values before you deploy to Azure.

Deploy to Azure

az login

az account set --subscription "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

az deployment group create --name demodeployment --resource-group {resource-group-name} --template-file .\DeployV2\{project-name}.JobTemplate.bicep --parameters .\DeployV2\{project-name}.JobTemplate.bicep.parameters.json

Next steps