Share via

Azure data explorer node.js sdk

Biswajit Das 1 Reputation point
2022-12-26T07:13:53.833+00:00

How can I use the Azure data explorer node.js SDK in my angular or any project ??
Because whenever I'm running the node.js SDK It's redirecting to the web for authentication for which I'm unable to figure out the full API link to use it in my project to perform CRUD operations on my Azure data explorer cluster / database. Thank you

Azure Data Explorer
Azure Data Explorer

An Azure data analytics service for real-time analysis on large volumes of data streaming from sources including applications, websites, and internet of things devices.


1 answer

Sort by: Most helpful
  1. PRADEEPCHEEKATLA 91,861 Reputation points
    2022-12-27T04:49:25.643+00:00

    Hello @Biswajit Das ,

    Thanks for the question and using MS Q&A platform.

    To use the Azure Data Explorer Node.js SDK in your Angular project, you will need to follow these steps:

    Install the Azure Data Explorer Node.js SDK by running the following command in your terminal:

    npm install @azure/kusto-data  
    

    Import the required modules in your Angular component or service where you want to use the Azure Data Explorer SDK. For example:

    import { KustoClient, ClientRequestProperties } from '@azure/kusto-data';  
    

    To authenticate with Azure Data Explorer, you will need to use a service principal or managed identity. You can follow the instructions in the Authenticate with Azure Data Explorer using a service principal or Authenticate with Azure Data Explorer using a managed identity documentation to set this up.

    Once you have authenticated, you can create a KustoClient instance and use it to perform CRUD operations on your Azure Data Explorer cluster and database. For example:

    const client = new KustoClient(clientRequestProperties);  
      
    // Insert data into a table  
    const insertCommand = `  
        INSERT INTO MyTable (Column1, Column2)  
        VALUES ('Value1', 'Value2')  
    `;  
      
    client  
      .execute(insertCommand)  
      .then((result) => {  
        console.log(`Inserted ${result.primaryResults[0].rowCount} rows`);  
      })  
      .catch((error) => {  
        console.error(error);  
      });  
    

    For more information on using the Azure Data Explorer Node.js SDK, you can refer to the Azure Data Explorer Node.js SDK documentation.

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is jhow you can be part of Q&A Volunteer Moderators
    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.