Azurite Azure Storage Emulator
raw JSON →Azurite is an open-source, cross-platform Azure Storage API compatible server designed for local development. It emulates the behavior of Azure Blob, Queue, and Table storage services, allowing developers to test their applications without incurring costs or latency associated with cloud resources. The current stable version is 3.35.0, with minor releases occurring approximately every 1-3 months, typically bumping the supported Azure Storage API version and introducing new features or bug fixes. Key differentiators include its full compatibility with Azure Storage SDKs, support for all three major storage services (Blob, Queue, Table preview), and flexible deployment options via npm, Docker, or a VS Code extension. It is built on TypeScript and runs on Node.js, providing a consistent local environment for Azure Storage interactions.
Common errors
error HTTP 400 One of the request inputs is not valid or similar errors when submitting batch requests. ↓
error All subsequent requests failing with a 500 error after a client prematurely disconnects. ↓
error Failure to delete a container after it was created with a blob, then deleted, and then recreated with the same name and a blob. ↓
error Error: Cannot find module 'azurite' or similar module resolution failures when attempting to `import` or `require` Azurite. ↓
import or require Azurite directly. Instead, run Azurite as a separate process (e.g., via child_process.spawn) or as a Docker container, and then interact with its HTTP endpoints using standard Azure Storage SDKs. Warnings
breaking Telemetry data collection is enabled by default since Azurite v3.34.0. Users must explicitly disable it if not desired. ↓
breaking Azurite V3 is a complete rewrite in TypeScript and is not directly compatible with configurations or APIs from the legacy Azurite V2. The legacy V2 code is on a separate branch and supports an older Azure Storage API version. ↓
gotcha By default, Azurite persists data to disk. For scenarios requiring ephemeral storage (e.g., CI/CD testing), explicit configuration is needed to avoid disk I/O. ↓
gotcha Specific Shared Access Signature (SAS) permissions were not correctly enforced for some operations in versions prior to 3.28.0, potentially leading to unintended access. ↓
breaking The Azure Storage API version supported by Azurite is periodically updated with new releases. Applications relying on specific older API versions might encounter unexpected behavior or errors if Azurite is updated past their targeted version. ↓
Install
npm install azurite yarn add azurite pnpm add azurite Imports
- azurite wrong
import { azurite } from 'azurite'correctN/A (run as CLI) - AzuriteServer wrong
import { AzuriteServer } from 'azurite'correctN/A (no public API) - BlobServiceClient wrong
import { BlobServiceClient } from 'azurite'correctN/A (use @azure/storage-blob)
Quickstart
import { spawn } from 'child_process';
import path from 'path';
async function startAzuriteProgrammatically() {
// Determine the Azurite command. Assumes global installation or local in node_modules/.bin
const azuriteCommand = process.platform === 'win32'
? path.join(process.cwd(), 'node_modules', '.bin', 'azurite.cmd')
: path.join(process.cwd(), 'node_modules', '.bin', 'azurite');
// Fallback to global command if local not found (or if installed globally)
const commandToExecute = require('which').sync(azuriteCommand, { nothrow: true }) || 'azurite';
const azuriteProcess = spawn(commandToExecute, [
'--blob', 'http://127.0.0.1:10000',
'--queue', 'http://127.0.0.1:10001',
'--table', 'http://127.0.0.1:10002',
'--location', './azurite_data', // Persist data to a local directory
'--debug', './azurite_debug.log', // Log debug info to a file
'--silent', // Suppress console output from Azurite itself
'--disableTelemetry' // Opt-out of telemetry data collection
]);
azuriteProcess.stdout.on('data', (data) => {
console.log(`Azurite stdout: ${data.toString()}`);
});
azuriteProcess.stderr.on('data', (data) => {
console.error(`Azurite stderr: ${data.toString()}`);
});
azuriteProcess.on('error', (err) => {
console.error(`Failed to start Azurite process: ${err.message}`);
});
azuriteProcess.on('close', (code) => {
console.log(`Azurite process exited with code ${code}`);
});
console.log('Attempting to start Azurite. Waiting for services to become available...');
await new Promise(resolve => setTimeout(resolve, 8000)); // Give Azurite time to start
console.log('Azurite should be running on Blob (10000), Queue (10001), Table (10002).');
console.log('Data will be persisted in ./azurite_data and debug logs in ./azurite_debug.log.');
// To stop Azurite, you would typically use azuriteProcess.kill(); in a real application
// For this quickstart, it will run until the Node.js script exits.
}
// You might need to 'npm install -g azurite' or 'npm install which' for this to run reliably.
// For local install: 'npm install azurite'
startAzuriteProgrammatically().catch(console.error);