Azure Files Tutorials

Learn how to create, manage, and integrate Azure Files shares in your applications.

Create a File Share

Step‑by‑step guide to creating a new Azure Files share using the portal and Azure CLI.

Mount Azure Files on Linux

Learn how to mount an Azure Files share on a Linux VM using SMB and CIFS.

Secure Access with Azure AD

Configure Azure AD authentication for Azure Files and integrate with RBAC.

Sample Code: Upload a File (Node.js)

Use the Azure Storage File Share SDK to upload a local file to a share.


// npm install @azure/storage-file-share
const { ShareServiceClient } = require("@azure/storage-file-share");
const fs = require("fs");

const connectionString = process.env.AZURE_STORAGE_CONNECTION_STRING;
const serviceClient = ShareServiceClient.fromConnectionString(connectionString);
async function uploadFile() {
    const shareName = "myshare";
    const directoryName = "";
    const fileName = "example.txt";

    const shareClient = serviceClient.getShareClient(shareName);
    const directoryClient = shareClient.getDirectoryClient(directoryName);
    const fileClient = directoryClient.getFileClient(fileName);

    const fileContent = fs.readFileSync("./example.txt");
    await fileClient.create(fileContent.length);
    await fileClient.uploadRange(fileContent, 0, fileContent.length);
    console.log("File uploaded successfully");
}
uploadFile().catch(console.error);
            

Toggle Syntax Highlighting