optimizing-azure-blob-storage-costlisted
Install: claude install-skill alexpizarro/azure-lean-stack-skills
# Optimizing Azure Blob Storage Cost
Default-low-cost blob storage with lifecycle rules tuned for media workloads (and any pattern with ephemeral temp blobs + long-lived primary blobs).
## When to invoke
- Adding a blob storage account to a project
- Designing for uploads (SAS-based) + serving (Range / CORS)
- Auditing an existing storage account that's growing unbounded
- A project that stores media (video, large images, archives) where retention > 60 days
## The two-pattern playbook
### Pattern A: temp + permanent containers
Most apps have two flavours of blob:
- **Temp** — short-lived working data (uploads being processed, intermediate transformations, cache)
- **Permanent** — user-visible content (videos, images, exports)
Apply different lifecycle rules to each:
```bicep
resource tempBlobLifecycle 'Microsoft.Storage/storageAccounts/managementPolicies@2023-05-01' = {
parent: storageAccount
name: 'default'
properties: {
policy: {
rules: [
// Rule 1: delete stale temp blobs after 7 days
{
enabled: true
name: 'delete-stale-temp-blobs'
type: 'Lifecycle'
definition: {
filters: {
blobTypes: ['blockBlob']
prefixMatch: ['incoming/', 'processor-jobs/', 'tmp/']
}
actions: {
baseBlob: { delete: { daysAfterModificationGreaterThan: 7 } }
}
}
}
// Rule 2: age permanent blobs through tiers — NEV