Azure Blob Storage with Spring Boot (azure-storage-blob)
Fast recall
Quick revision
Core answer
Practical knowledge of Azure storage SDK integration in Spring Boot, including authentication and streaming uploads.
Using a storage account connection string instead of Managed Identity or SAS tokens, or loading the full blob into memory for large files.
Mention streaming uploads with BlockBlobClient, SAS token generation for temporary client access, and blob lifecycle management policies.
Interview-ready guide
Interview answer
Azure Blob Storage integration with Spring Boot follows the same architectural decision as S3: proxy the bytes through your server, or generate a SAS URL and let the client upload directly.
Spring Cloud Azure setup
- Add
spring-cloud-azure-starter-storage-blob; configurespring.cloud.azure.storage.blob.account-name; injectBlobServiceClientor the higher-levelStorageResourceas a SpringResource— which means Spring's resource abstraction works with blob URLs using theazure-blob://prefix
SAS (Shared Access Signature) URLs — for direct client upload
- Generate a SAS URL on the server:
BlobServiceClient.generateAccountSas()orBlobClient.generateSas()with aBlobSasPermissionand expiry — the client receives a time-limited URL to upload directly to blob storage without passing bytes through your server - Which means your server avoids the bandwidth and memory cost of large file uploads; blob storage receives the data directly from the client
Direct upload via server
- When you need to validate, virus-scan, or transform content before storage:
blobClient.upload(inputStream, length, true)streams the data to blob storage; setContent-TypeandContent-Dispositionon the upload to ensure correct browser download behavior - For large files, use
BlobClient.uploadFromFile()or block blob upload with parallel transfers:ParallelTransferOptionsconfigures block size and max concurrency
Access tiers
- Hot tier for frequently accessed data; Cool tier for data accessed infrequently (lower storage cost, higher access cost); Archive tier for data retained for compliance that's rarely accessed — lifecycle management policies transition blobs automatically between tiers based on last-modified date
- Enable soft delete on the container so accidental overwrites or deletions can be recovered within the retention window
Azure Blob Storage with Spring Boot (azure-storage-blob)
Direct Answer
Use the Spring Cloud Azure starter for Blob Storage. Inject BlobServiceClient or BlobContainerClient, and call upload/download methods. Authenticate with Managed Identity — no connection strings in code.
Common Mistakes & Pitfalls
Using a storage account connection string instead of Managed Identity or SAS tokens, or loading the full blob into memory for large files.
Check your understanding
Answer these without looking back at the article.
- How do you generate a SAS token for temporary blob access in Java?
- What is the difference between block blobs, append blobs, and page blobs?
- How do you configure blob lifecycle management to reduce storage costs?
Related interview prep categories
1Looking for a structured roadmap?
Every module on this page is also part of the full Java backend interview track.