TypeScript icon, indicating that this package has built-in type declarations

    3.4.2 • Public • Published

    Microsoft Azure Kusto Data Library for Node


    npm install azure-kusto-data

    Quick Start

    const KustoClient = require("azure-kusto-data").Client;
    const KustoConnectionStringBuilder = require("azure-kusto-data").KustoConnectionStringBuilder;
    const kcsb = KustoConnectionStringBuilder.withAadApplicationKeyAuthentication(`https://${clusterName}`, "appid", "appkey", "authorityId");
    const client = new KustoClient(kcsb);
    // `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");


    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.

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

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

    const kcsb = KustoConnectionStringBuilder.withAadApplicationCertificateAuthentication(

    Option 3: Authenticating using AAD Managed Identities.

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


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

    Authority is optional when it can inferred from the domain ('' would make the authority ''). In any case it is possible to pass the authority id

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


    Using this method will write a token to the console, which can be used to authenticate at and will allow temporary access.

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

    // will log the DEVICE token and url to use
    KustoConnectionStringBuilder.withAadDeviceAuthentication(`https://${clusterName}`, 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}`, 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 and run the following command:

    az login

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

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

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


    Query language docs can be found at

    Advanced Usage


    For more fine grained control, we expose ClientRequestProperties.

    const ClientRequestProperties = require("azure-kusto-data").ClientRequestProperties;
    const Client = require("azure-kusto-data").Client;
    const client = new Client("");
    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


    npm i azure-kusto-data

    DownloadsWeekly Downloads






    Unpacked Size

    134 kB

    Total Files


    Last publish


    • dadubovs
    • boshalom
    • arielyehezkely