Gestire Azure Data Lake Analytics tramite Azure SDK per Node.js

Importante

Azure Data Lake Analytics ritirato il 29 febbraio 2024. Altre informazioni con questo annuncio.

Per l'analisi dei dati, l'organizzazione può usare Azure Synapse Analytics o Microsoft Fabric.

Questo articolo descrive come gestire account, origini dati, processi e utenti di Azure Data Lake Analytics usando un'app scritta con Azure SDK per Node.js.

Sono supportate le versioni seguenti:

  • Versione di Node.js: 0.10.0 o successiva
  • Versione dell'API REST per l'account: 2015-10-01-preview

Funzionalità

  • Gestione account: creare, ottenere, elencare, aggiornare ed eliminare.

Modalità di installazione

npm install @azure/arm-datalake-analytics

Eseguire l'autenticazione con Microsoft Entra ID

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

Creare il client di Analisi Data Lake

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

Creare un account di Analisi 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
      }
    */
}) 

Vedi anche