Skip to main content
The Azure storage driver integrates with Azure Blob Storage, Microsoft’s object storage solution for the cloud. It provides highly available, secure, and scalable storage with global distribution capabilities.

Installation

The Azure driver is included by default with Directus via the @directus/storage-driver-azure package, which uses the Azure Storage SDK.

Configuration

Configure Azure storage using environment variables:

Configuration Options

string
required
The Azure Blob Storage container name where files will be stored.
string
required
The Azure Storage account name.
string
required
The Azure Storage account access key.
string
Optional path prefix for all files within the container.
string
Custom endpoint URL. Default: https://{accountName}.blob.core.windows.net.
boolean
Enable TUS resumable uploads. Default: false.
number
Chunk size for resumable uploads in bytes. Maximum: 104857600 (100 MiB). Only used when TUS is enabled.

Examples

Basic Configuration

With Root Path

Custom Endpoint

With Resumable Uploads

Features

Resumable Uploads

The Azure driver supports TUS resumable uploads using Azure Append Blobs from /packages/storage-driver-azure/src/index.ts:23-151:
  • Uses Azure Append Blob for chunked uploads
  • Maximum chunk size: 100 MiB (enforced)
  • Resume interrupted uploads
  • Automatic chunk accumulation

Blob Types

The driver uses different blob types for different operations:
  • Block Blobs - Standard uploads and file storage
  • Append Blobs - Resumable TUS uploads

Copy Operations

Azure native copy operations from /packages/storage-driver-azure/src/index.ts:93-99:
  • Server-side copy without data transfer
  • Asynchronous operation with polling
  • No bandwidth usage for copying

Implementation Details

The Azure driver (DriverAzure class) from /packages/storage-driver-azure/src/index.ts:23-151:
  • Maximum chunk size validation: 100 MiB from /packages/storage-driver-azure/src/index.ts:9
  • Uses StorageSharedKeyCredential for authentication
  • Supports custom endpoints for government and sovereign clouds
  • Implements efficient streaming for large files

Best Practices

Access Keys

Securely store your access keys:
Rotate access keys regularly from the Azure Portal.

Container Configuration

Create the container before using it:

Access Tiers

Configure blob access tier for cost optimization:
  • Hot - Frequently accessed files
  • Cool - Infrequently accessed files (30+ days)
  • Archive - Rarely accessed files (180+ days)

CORS Configuration

If accessing files directly from browsers:

Lifecycle Management

Configure lifecycle policies to automatically transition or delete blobs:

Authentication Alternatives

Consider using Azure Active Directory (Managed Identity) for enhanced security:
  1. Enable Managed Identity on your Azure App Service
  2. Grant “Storage Blob Data Contributor” role to the managed identity
  3. Use DefaultAzureCredential in custom implementations
Note: The current driver uses account key authentication. For Managed Identity support, you would need to extend the driver.

Performance Optimization

  • Use Azure CDN for frequently accessed files
  • Enable Azure Storage Analytics for monitoring
  • Consider Azure Premium Storage for high IOPS requirements
  • Use zone-redundant storage (ZRS) or geo-redundant storage (GRS) based on availability needs

Networking

Configure network rules for enhanced security:

Troubleshooting

Authentication Errors

  1. Verify account name and key are correct
  2. Check if the storage account exists
  3. Ensure the account key has not been rotated
  4. Verify network access rules

Container Not Found

Ensure the container exists:

Chunk Size Errors

If you see “Invalid chunkSize provided” error:
  • Maximum chunk size is 100 MiB (104857600 bytes)
  • Reduce STORAGE_AZURE_TUS__CHUNK_SIZE value

Connection Issues

  1. Verify endpoint URL is correct
  2. Check firewall and network security group rules
  3. Ensure the storage account is not behind a VNet without proper access
  4. Test connectivity: curl https://{accountName}.blob.core.windows.net