# azure-streamanalytics-cicd

> This package supports the CI/CD of Stream Analytics Visual Studio and Visual Studio Code projects.

Latest version **4.0.1** (published 2026-09-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install azure-streamanalytics-cicd
pnpm add azure-streamanalytics-cicd
yarn add azure-streamanalytics-cicd
bun add azure-streamanalytics-cicd
```

Provides the command `azure-streamanalytics-cicd`.

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 4.0.1 |
| Published | 2026-09-23 |
| First published | 2019-05-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 462.5 KB |
| Known vulnerabilities | 0 (+3 in 1 direct dependencies) |
| Install scripts | yes |
| Author | Microsoft Corporation |
| Maintainers | azure-sdk, microsoft1es |
| Keywords | azure, azure stream analytics, stream analytics, asa cicd, cicd, asa |

## Links

- npm: https://www.npmjs.com/package/azure-streamanalytics-cicd
- Issues: https://aka.ms/asacicdissue
- npm.io page: https://npm.io/package/azure-streamanalytics-cicd

## Dependencies (7)

- [chalk](https://npm.io/package/chalk.md) 3.0.0
- [rimraf](https://npm.io/package/rimraf.md) 3.0.2
- [adm-zip](https://npm.io/package/adm-zip.md) 0.5.10
- [progress](https://npm.io/package/progress.md) ^2.0.3
- [stream-buffers](https://npm.io/package/stream-buffers.md) ^3.0.2
- [compare-versions](https://npm.io/package/compare-versions.md) 3.6.0
- [https-proxy-agent](https://npm.io/package/https-proxy-agent.md) 5.0.0

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 4.0.1 (latest) — 2026-09-23
- 4.0.0 — 2026-06-22
- 3.1.6 — 2026-03-06
- 3.1.5 — 2024-03-14
- 3.1.4 — 2023-11-22
- 3.1.3 — 2023-08-18
- 3.1.2 — 2023-07-05
- 3.1.1 — 2023-06-15
- 3.1.0 — 2023-05-26
- 3.0.2 — 2023-04-24
- 3.0.1 — 2023-02-17
- 3.0.0 — 2023-02-10
- 2.4.1 — 2022-12-28
- 2.4.0 — 2022-10-21
- 2.3.2 — 2022-09-13
- … 24 more at https://npm.io/package/azure-streamanalytics-cicd/versions

## README

# CI/CD tool for Azure Stream Analytics jobs

- [CI/CD tool for Azure Stream Analytics jobs](#cicd-tool-for-azure-stream-analytics-jobs)
  - [Install](#install)
  - [Build project](#build-project)
  - [Configure autoscale settings](#configure-autoscale-settings)
  - [Run locally](#run-locally)
  - [Add automated test](#add-automated-test)
    - [Add a test case](#add-a-test-case)
    - [Run unit test](#run-unit-test)
  - [Deploy to Azure](#deploy-to-azure)
  - [Next steps](#next-steps)

The Azure Stream Analytics (ASA) CI/CD npm package allows you to automatically build, test, and deploy your Stream Analytics projects. If you don't have a Stream Analytics project, follow this guide to [create one using Visual Studio Code](https://aka.ms/asavscodequickstart) or [export one from Azure](https://learn.microsoft.com/azure/stream-analytics/visual-studio-code-explore-jobs#export-a-job-to-a-local-project).

This article explains how to use the npm package with any CI/CD system. To set up a pipeline with Azure DevOps, see [Use Azure DevOps to create a CI/CD pipeline for a Stream Analytics job](https://aka.ms/asacicdpipeline).

## Install

```powershell
npm install -g azure-streamanalytics-cicd
```

Install .NET 8.0 or later before installing this package. Installation downloads
the versioned runtime archive from the packaged manifest and verifies its
SHA256 when pinned. A failed download or invalid archive fails installation.
The installed `bin\runtime-artifact.json` records the runtime URL, archive hash,
and LocalQueryRuntime package version.

## Build project

> [!NOTE]
> We highly recommend that you use the `--v2` option for the updated ARM template schema. The updated schema has fewer parameters yet retains the same functionality as the previous version.
>
> The old ARM template will be deprecated in the future. From now on, only templates that were created via `build --v2` will receive updates or bug fixes.

```powershell
# Generate ARM template
azure-streamanalytics-cicd build --v2 --project <projectFullPath> [--outputPath <outputPath>] 
# Generate Bicep template
azure-streamanalytics-cicd build --v2 --project <projectFullPath> [--outputPath <outputPath>] --type Bicep
```

The *build* command does a keyword syntax check and generates Azure Resource Manager (ARM) templates.

| Argument | Description |
|---|---|
| `--project` | Specify the **asaproj.json** file using absolute or relative path. |
| `--outputPath` |  Specify the output folder for storing ARM Templates using absolute or relative path. If `outputPath` is not specified, the templates will be placed in the current directory. |
| `--type` | The template type for Azure resource deployment. Valid values are 'ARM' (for ARM templates) and 'Bicep' (for Bicep templates). Note that **Bicep** templates are only available with `--v2` option and .NET 8.0 environments. If you do not specify a template type, the default is 'ARM'. |

**Example**:

```powershell
# Go to the project directory
cd <path-to-the-project>

# Build project to generate ARM template
azure-streamanalytics-cicd build --v2 --project ./asaproj.json --outputPath ./Deploy

# Build project to generate Bicep template
azure-streamanalytics-cicd build --v2 --project ./asaproj.json --outputPath ./Deploy --type Bicep
```

If the project is built successfully, you see 2 files created under the output folder:
- ARM template
    - ARM template file: `[ProjectName].JobTemplate.json`
    - ARM parameter file: `[ProjectName].JobTemplate.parameters.json`
- Bicep
    - Bicep template 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 are required to set the values before you deploy to Azure.

```json
"Input_EntryStream_sharedAccessPolicyKey": {
  "value": null
}
```

To use Managed Identity for Azure Data Lake Store Gen1 as output sink, you need to provide Access to the service principal using PowerShell before deploying to Azure. Learn more about how to [deploy ADLS Gen1 with Managed Identity with Resource Manager template](https://aka.ms/asamideploy).

## Configure autoscale settings

```powershell
azure-streamanalytics-cicd autoscale --capacity <maximumSU> --metrics <metricNames> --targetJobName <jobName> [--outputPath <outputPath>]
```

You can configure autoscale settings for your Stream Analytics job to dynamically adjusts streaming units (SUs) based on your rule definitions.

The CI/CD npm package allows you to specify the maximum SUs and configure a set of rules for autoscaling your jobs. Then it determines whether to add SUs (to handle increases in load) or reduce the number of SUs (when computing resources are sitting idle).

Here're the arguments supported for `autoscale` command:

| Argument key | Value | Example|
|----------------|--------|--------|
|`--capacity`| Maximum SUs (1, 3, 6, or multiples of 6 up to 396)|`12`|
|`--metrics` | Metric names that defines what the rules monitor, separated by whitespace | `ProcessCPUUsagePercentage` `ResourceUtilization`|
|`--targetJobName`| Project name | `ClickStream-Filter`|
|`--targetJobResourceId`| Job resource ID | \- |
|`--outputPath`| Output path for ARM templates | `./Deploy`|

> [!NOTE]
> You could either specify the target job name or the target job resource ID. If you specify the target job name, please make sure that you deploy the autoscale settings to the same subscription and resource group as the target job.

**Example**:

```powershell
azure-streamanalytics-cicd autoscale --capacity 12 --metrics ProcessCPUUsagePercentage ResourceUtilization --targetJobName ClickStream-Filter --outputPath ./Deploy
```

If the autoscale setting is configured successfully, you see 2 JSON files created under the output folder:

* ARM template file: `[ProjectName].AutoscaleSettingTemplate.json`
* ARM parameter file: `[ProjectName].AutoscaleSettingTemplate.parameters.json`

To learn more about autoscale settings, see [Configure autoscale settings for a Stream Analytics job by using the CI/CD tool](https://learn.microsoft.com/azure/stream-analytics/cicd-autoscale).

## Run locally

If your project has specified local input files, you can run a Stream Analytics script locally by using the `localrun` command.

```powershell
azure-streamanalytics-cicd localrun --project <projectFullPath> [--outputPath <outputPath>] [--customCodeZipFilePath <zipFilePath>]
```

| Argument | Description |
|---|---|
| `--project` | Specify the **asaproj.json** file using absolute or relative path. |
| `--outputPath` |  Specify the output folder for storing ARM Templates using absolute or relative path. If `outputPath` is not specified, the templates will be placed in the current directory. |
| `--customCodeZipFilePath` | The path of the zip file for C# custom code, such as a UDF or deserializer, if they are used. Package the DLLs into a zip file and specify this path. |

**Example**:

```powershell
# Go to the project directory
cd <path-to-the-project>

# Run project locally
azure-streamanalytics-cicd localrun --project ./asaproj.json"
```

> [!NOTE]
> JavaScript UDF and UDA only work on Windows.

## Add automated test

You can use the CI/CD npm package to configure and run automated tests for your Stream Analytics project.

### Add a test case

```powershell
azure-streamanalytics-cicd addtestcase --project <projectFullPath> [-testConfigPath <testConfigFileFullPath>]
```

You can find the test cases in the test configuration file.

| Argument | Description |
|---|---|
| `--project` | Specify the **asaproj.json** file using absolute or relative path. |
| `--testConfigPath` | The path of the test configuration file. If it is not specified, the file will be searched in **\test** under the current directory of the **asaproj.json** file, with default file name **testConfig.json**. A new file will be created if not existed. |

**Example**:

```powershell
# Go to the project directory
cd <path-to-the-project>

# Add a test case
azure-streamanalytics-cicd addtestcase --project ./asaproj.json
```

If the test configuration file is empty, the following content is added to the file. Otherwise, a test case is added to a **TestCases** array. Necessary input configurations are automatically filled according to the input configuration file. **FilePath** of each input and expected output must be specified before running the test. You can modify this configuration manually.

If you want the test validation to ignore a certain output, set the **Required** field of that expected output to **false**.

```json
{
  "Script": [Absolute path of your script],
  "TestCases": [
    {
      "Name": "Case 1",
      "Inputs": [
        {
          "InputAlias": [Input alias string],
          "Type": "Data Stream",
          "Format": "JSON",
          "FilePath": [Required],
          "ScriptType": "InputMock"
        }
      ],
      "ExpectedOutputs": [
        {
          "OutputAlias": [Output alias string],
          "FilePath": [Required],
          "IgnoreFields": [Fields to ignore for test validation, e.g., ["col1", "col2"]],
          "Required": true
        }
      ]
    }
  ]
}
```

### Run unit test

You can use the following command to run multiple test cases for your project. A summary of test results is generated in the output folder. The process exits with code **0** for all tests passed; **-1** for exception occurred; **-2** for tests failed.

```powershell
azure-streamanalytics-cicd test --project <projectFullPath> [--testConfigPath <testConfigFileFullPath>] [--outputPath <outputPath>] [--customCodeZipFilePath <zipFilePath>]
```

| Argument | Description |
|---|---|
| `--project` | The path of the **asaproj.json** file. |
| `--testConfigPath` | The path to the test configuration file. If it is not specified, the file will be searched in **\test** under the current directory of the **asaproj.json** file, with default file name **testConfig.json**.
| `--outputPath` | The path of the test result output folder. If it is not specified, the output result files will be placed in the current directory. |
| `--customCodeZipFilePath` | The path of the zip file for custom code such as a UDF or deserializer, if they are used. You need to package the DLLs to zip file and specify the path. |

If test cases are executed, you can find a **testResultSummary.json** file generated in the output folder.

```json
{
  "Total": (integer) total_number_of_test_cases,
  "Passed": (integer) number_of_passed_test_cases,
  "Failed": (integer) number_of_failed_test_cases,
  "Script": (string) absolute_path_to_asaql_file,
  "Results": [ (array) detailed_results_of_test_cases
    {
      "Name": (string) name_of_test_case,
      "Status": (integer) 0(passed)_or_1(failed),
      "Time": (string) time_span_of_running_test_case,
      "OutputMatched": [ (array) records_of_actual_outputs_equal_to_expected_outputs
        {
          "OutputAlias": (string) output_alias,
          "ExpectedOutput": (string) path_to_the_expected_output_file,
          "Output": (string) path_to_the_actual_output_file
        }
      ],
      "OutputNotEqual": [ (array) records_of_actual_outputs_not_equal_to_expected_outputs
        {
          "OutputAlias": (string) output_alias,
          "ExpectedOutput": (string) path_to_the_expected_output_file,
          "Output": (string) path_to_the_actual_output_file
        }
      ],
      "OutputMissing": [ (array) records_of_actual_outputs_missing
        {
          "OutputAlias": (string) output_alias,
          "ExpectedOutput": (string) path_to_the_expected_output_file,
          "Output": ""
        }
      ],
      "OutputUnexpected": [ (array) records_of_actual_outputs_unexpected
        {
          "OutputAlias": (string) output_alias,
          "ExpectedOutput": "",
          "Output": (string) path_to_the_actual_output_file
        }
      ],
      "OutputUnrequired": [ (array) records_of_actual_outputs_unrequired_to_be_checked
        {
          "OutputAlias": (string) output_alias,
          "ExpectedOutput": (string) path_to_the_expected_output_file,
          "Output": (string) path_to_the_actual_output_file
        }
      ]
    }
  ],
  "Time": (string) time_span_of_running_all_test_cases,
}
```

> [!NOTE]
> If the query results contain float values, you might experience slight differences in the produced values leading to a probably failed test. This is based on the different .Net frameworks powering the Visual Studio or Visual Studio engine and the test processing engine. If you want to make sure that the tests run successfully, you will have to decrease the precision of your produced values or align the results to be compared manually to the generated test results.

## Deploy to Azure

To deploy your Stream Analytics project using ARM templates, check out these docs:

* [Deploy with a Resource Manager template file and Azure PowerShell](https://aka.ms/armdeploytemplate).
* [Use an object as a parameter in a Resource Manager template](https://learn.microsoft.com/azure/azure-resource-manager/templates/parameters#objects-as-parameters).

## Next steps

* [Continuous integration and Continuous deployment for Azure Stream Analytics](https://aka.ms/asacicdoverview)
* [Set up CI/CD pipeline for Stream Analytics job using Azure Pipelines](https://aka.ms/asacicdpipeline)

---
_Source: https://npm.io/package/azure-streamanalytics-cicd · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
