Azure SDK for Node.js を使用して Azure Data Lake Analytics を管理する

重要

Azure Data Lake Analytics 2024 年 2 月 29 日に廃止されました。 詳細については、このお知らせを参照してください。

データ分析の場合、organizationでは Azure Synapse Analytics または Microsoft Fabric を使用できます。

この記事では、Azure SDK for Node.js を使用して記述されたアプリを使用して、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 Analytics クライアントを作成する

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

Data Lake Analytics アカウントを作成する

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
      }
    */
}) 

こちらもご覧ください