# azure-kusto-data

> Azure Data Explorer Query SDK

Latest version **7.2.0** (published 2026-05-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install azure-kusto-data
pnpm add azure-kusto-data
yarn add azure-kusto-data
bun add azure-kusto-data
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 7.2.0 |
| Published | 2026-05-13 |
| First published | 2018-10-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 20.0.0 |
| Dependencies | 9 |
| Unpacked size | 355.9 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 54 |
| Maintainers | microsoft1es, microsoft-oss-releases, arielyehezkely, dadubovs, asafmahlev, boshalom |
| Keywords | node, azure, kusto |

## Links

- npm: https://www.npmjs.com/package/azure-kusto-data
- Repository: https://github.com/Azure/azure-kusto-node
- Homepage: https://github.com/Azure/azure-kusto-node/blob/master/azure-kusto-data/README.md
- Issues: https://github.com/Azure/azure-kusto-node/issues
- npm.io page: https://npm.io/package/azure-kusto-data

## Dependencies (9)

- [uuid](https://npm.io/package/uuid.md) ^8.3.2
- [axios](https://npm.io/package/axios.md) ^1.16.0
- [@types/uuid](https://npm.io/package/@types/uuid.md) ^8.3.4
- [stream-http](https://npm.io/package/stream-http.md) ^3.2.0
- [@azure/identity](https://npm.io/package/@azure/identity.md) ^4.13.1
- [@azure/core-auth](https://npm.io/package/@azure/core-auth.md) ^1.10.0
- [@azure/core-util](https://npm.io/package/@azure/core-util.md) ^1.13.1
- [follow-redirects](https://npm.io/package/follow-redirects.md) ^1.15.11
- [https-browserify](https://npm.io/package/https-browserify.md) ^1.0.0

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 7.2.0 (latest) — 2026-05-13
- 7.1.0 — 2026-04-14
- 7.0.4 — 2025-12-29
- 7.0.3 — 2025-11-25
- 7.0.2 — 2025-11-25
- 7.0.1 — 2025-07-20
- 7.0.0 — 2025-05-07
- 6.0.4 — 2025-04-28
- 6.0.3 — 2025-01-26
- 7.0.0-alpha.4 — 2025-01-23
- 7.0.0-alpha.3 — 2024-09-29
- 7.0.0-alpha.2 — 2024-09-24
- 7.0.0-alpha.1 — 2024-09-22
- 7.0.0-alpha.0 — 2024-09-16
- 6.0.2 — 2024-04-11
- … 65 more at https://npm.io/package/azure-kusto-data/versions

## README

# Microsoft Azure Kusto Data Library for JavaScript

## Installation

`npm install azure-kusto-data`

## Quick Start

```javascript
const KustoClient = require("azure-kusto-data").Client;
const KustoConnectionStringBuilder = require("azure-kusto-data").KustoConnectionStringBuilder;

const kcsb = KustoConnectionStringBuilder.withAadApplicationKeyAuthentication(`https://${clusterName}.kusto.windows.net`, "appid", "appkey", "authorityId");
const client = new KustoClient(kcsb);
// When no longer needed, close the client with the `close` method.

// `execute()` infers the type of command from the query, although you can also specify the type explicitly using the methods `excuteQuery()`,`executeQueryV1()` or `executeMgmt()`
const results = await client.execute("db", "TableName | limit 1");
console.log(JSON.stringify(results));
console.log(results.primaryResults[0].toString());
```

## Authentication

There are several authentication methods

### AAD application

There are three ways to authenticate using AAD application:

Option 1: Authenticating using AAD application id and corresponding key.

```javascript
const kcsb = KustoConnectionStringBuilder.withAadApplicationKeyAuthentication(`https://${clusterName}.kusto.windows.net`, "appid", "appkey", "authorityId");
```

Option 2.1: Authenticating using AAD application id and corresponding certificate.

```javascript
const kcsb = KustoConnectionStringBuilder.withAadApplicationCertificateAuthentication(
    `https://${clusterName}.kusto.windows.net`,
    "appid",
    "certificate",
    "authorityId"
);

Option 2.2: Authenticating using AAD application id and corresponding certificate with SNI public key.
Concat the private and publiccertificates
```javascript
const kcsb = KustoConnectionStringBuilder.withAadApplicationCertificateAuthentication(
    `https://${clusterName}.kusto.windows.net`,
    "appid",
    "-----BEGIN CERTIFICATE-----
... <cert1> ...
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
... <cert2> ...
-----END PRIVATE KEY-----",
    "authorityId",
    true
);
```

Option 3: Authenticating using [AAD Managed Identities](https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview).

```javascript
const kcsb = KustoConnectionStringBuilder.withSystemManagedIdentity(`https://${clusterName}.kusto.windows.net`);
const kcsb = KustoConnectionStringBuilder.withUserManagedIdentity(`https://${clusterName}.kusto.windows.net`, clientId);
```

### Username/Password

```javascript
KustoConnectionStringBuilder.withAadUserPasswordAuthentication(`https://${clusterName}.kusto.windows.net`, "username", "password");
```

Authority is optional _when it can inferred from the domain_ ('user@microsoft.com' would make the authority 'microsoft.com').
In any case it is possible to pass the authority id

```javascript
KustoConnectionStringBuilder.withAadUserPasswordAuthentication(`https://${clusterName}.kusto.windows.net`, "username", "password", "authorityId");
```

### Device

Using this method will write a token to the console, which can be used to authenticate at https://login.microsoftonline.com/common/oauth2/deviceauth and will allow temporary access.

**<!>It is not meant for production purposes<!>**

```javascript
// will log the DEVICE token and url to use
KustoConnectionStringBuilder.withAadDeviceAuthentication(`https://${clusterName}.kusto.windows.net`, authId);

// in case you want to do your own thing with the response, you can pass a callback
// NOTICE: code will still block until device is authenticated
KustoConnectionStringBuilder.withAadDeviceAuthentication(`https://${clusterName}.kusto.windows.net`, authId, (tokenResponse) => {
    // your code, for example copy to clipboard or open url in browser
    console.log("Open " + tokenResponse.verificationUrl + " and use " + tokenResponse.userCode + " code to authorize.");
});
```

### Az Login

You will need to [install the azure-cli](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) and run the following command:

```bash
az login
```

This method uses the token stored in azure cli for authentication.

**<!>This is not recommeneded for unattended authentication<!>**

```javascript
const kcsb = KustoConnectionStringBuilder.withAzLoginIdentity(`https://${clusterName}.kusto.windows.net`); // optionally also pass authorityId
```

## Usage

Query language docs can be found at https://docs.microsoft.com/en-us/azure/data-explorer/write-queries#overview-of-the-query-language

## Advanced Usage

### ClientRequestProperties

For more fine grained control, we expose `ClientRequestProperties`.

```javascript
const ClientRequestProperties = require("azure-kusto-data").ClientRequestProperties;
const Client = require("azure-kusto-data").Client;

const client = new Client("http://cluster.region.kusto.windows.net");
const query = `
declare query_parameters(amount:long);
T | where amountColumn == amount
`;
const clientRequestProps = new ClientRequestProperties();
clientRequestProps.setOption("servertimeout", 1000 * 60);
clientRequestProps.setParameter("amount", 100);
const results = await client.executeQuery("db", query, clientRequestProps);
```

A full list of those properties can be found at https://docs.microsoft.com/en-us/azure/kusto/api/netfx/request-properties

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