Share via


Node.js용 Azure SDK를 사용하여 Azure 데이터 레이크 분석 관리

중요

Azure Data Lake Analytics 2024년 2월 29일에 사용 중지되었습니다. 이 공지 사항을 통해 자세히 알아봅니다.

데이터 분석의 경우 organization Azure Synapse Analytics 또는 Microsoft Fabric을 사용할 수 있습니다.

이 문서에서는 Node.js용 Azure SDK를 사용하여 작성된 앱을 사용하여 Azure Data Lake Analytics 계정, 데이터 원본, 사용자 및 작업을 관리하는 방법을 설명합니다.

지원되는 버전은 다음과 같습니다.

  • Node.js 버전: 0.10.0 이상
  • 계정에 대한 REST API 버전: 2015-10-01-preview

기능

  • 계정 관리: 만들기, 가져오기, 나열, 업데이트 및 삭제

설치 방법

npm install @azure/arm-datalake-analytics

Microsoft Entra ID 사용하여 인증

const { DefaultAzureCredential } = require("@azure/identity");
//service principal authentication
var credentials = new DefaultAzureCredential();

Data Lake 분석 클라이언트 만들기

const { DataLakeAnalyticsAccountManagementClient } = require("@azure/arm-datalake-analytics");
var accountClient = new DataLakeAnalyticsAccountManagementClient(credentials, 'your-subscription-id');

Data Lake 분석 계정 만들기

var util = require('util');
var resourceGroupName = 'testrg';
var accountName = 'testadlaacct';
var location = 'eastus2';

// A Data Lake Store account must already have been created to create
// a Data Lake Analytics account. See the Data Lake Store readme for
// information on doing so. For now, we assume one exists already.
var datalakeStoreAccountName = 'existingadlsaccount';

// account object to create
var accountToCreate = {
  tags: {
    testtag1: 'testvalue1',
    testtag2: 'testvalue2'
  },
  name: accountName,
  location: location,
  properties: {
    defaultDataLakeStoreAccount: datalakeStoreAccountName,
    dataLakeStoreAccounts: [
      {
        name: datalakeStoreAccountName
      }
    ]
  }
};

client.accounts.beginCreateAndWait(resourceGroupName, accountName, accountToCreate).then((result)=>{
  console.log('result is: ' + util.inspect(result, {depth: null}));
}).catch((err)=>{
  console.log(err);
    /*err has reference to the actual request and response, so you can see what was sent and received on the wire.
      The structure of err looks like this:
      err: {
        code: 'Error Code',
        message: 'Error Message',
        body: 'The response body if any',
        request: reference to a stripped version of http request
        response: reference to a stripped version of the response
      }
    */
}) 

추가 정보