.NET 10 How to implement it
| Library / API | Package | Use it for |
| Blob Storage | Azure.Storage.Blobs | Upload and download, AccessTier (Hot / Cool / Cold / Archive), SetAccessTierAsync, SAS with BlobSasBuilder or GenerateSasUri, immutability policies |
| Azure Files | Azure.Storage.Files.Shares | Manage SMB/NFS shares and files from code (apps usually just mount the share) |
| Amazon S3 | AWSSDK.S3 | PutObjectAsync, storage classes, presigned URLs (GetPreSignedURL) |
| Lifecycle rules | Storage account policy (Bicep / Terraform) or Azure.ResourceManager.Storage | Tiering and deletion are platform rules, not app code |
var service = new BlobServiceClient(new Uri(accountUrl), new DefaultAzureCredential());
var blob = service.GetBlobContainerClient("statements").GetBlobClient($"{accountId}/2026-10.pdf");
await blob.UploadAsync(pdfStream, new BlobUploadOptions { AccessTier = AccessTier.Hot });
// Short-lived, read-only link signed with Entra ID (user delegation SAS)
var expires = DateTimeOffset.UtcNow.AddMinutes(15);
UserDelegationKey key = await service.GetUserDelegationKeyAsync(DateTimeOffset.UtcNow, expires);
var sas = new BlobSasBuilder(BlobSasPermissions.Read, expires)
{
BlobContainerName = blob.BlobContainerName,
BlobName = blob.Name,
Resource = "b" // a single blob
};
Uri link = new BlobUriBuilder(blob.Uri) { Sas = sas.ToSasQueryParameters(key, service.AccountName) }.ToUri();
The identity requesting the user delegation key needs the "Storage Blob Delegator" role (or a data role that includes it), and the SAS can never grant more than that identity's own access.
Block vs file vs object storage, in one minute 🗄
💽 Block: a raw disk for one machine. Fast. Databases live here
📁 File: a shared folder over SMB/NFS. Many servers, one path
🪣 Object: a bucket over HTTP. Massive scale, cheapest per GB. Documents, backups, data lakes
💸 Then let lifecycle rules move old objects Hot → Cool → Cold → Archive, and lock records with WORM
Bonus: never stream big files through your API. Give the client a 15-minute SAS or presigned URL.
#CloudStorage #Azure #AWS #SystemDesign