Azure Data Lake Storage – Quickstart

Documentation Home

Get Started in 3 Minutes

This quickstart shows you how to create a Data Lake Storage Gen2 account, upload a file, and list its contents using Azure SDK for JavaScript (browser).

  1. Sign in to the Azure portal and create a Storage account with Hierarchical namespace enabled.
  2. Obtain the account name and account key from the Access keys blade.
  3. Paste the credentials below and click Upload Sample File.

Sample Code (Node.js)

const { DefaultAzureCredential } = require("@azure/identity");
const { BlobServiceClient } = require("@azure/storage-blob");

async function main() {
    const account = process.env.AZURE_STORAGE_ACCOUNT;
    const url = `https://${account}.blob.core.windows.net`;
    const credential = new DefaultAzureCredential();
    const client = new BlobServiceClient(url, credential);

    const container = client.getContainerClient("sample-container");
    await container.createIfNotExists();

    const blockBlob = container.getBlockBlobClient("hello.txt");
    await blockBlob.upload("Hello Azure Data Lake Storage!", 30);
    console.log("File uploaded.");
}
main().catch(console.error);