Cost Optimization Strategies
Storage and delivery costs creep up quietly โ a few extra GB here, an unoptimized access tier there. These are the levers that actually move the bill.
Storage tiers
Section titled โStorage tiersโBlob Storage bills differently depending on access tier, and most sites keep everything in the most expensive one by default:
| Tier | Best for | Relative cost |
|---|---|---|
| Hot | Frequently accessed images (siteโs active content) | Highest storage cost, lowest access cost |
| Cool | Infrequently accessed (archived uploads, old versions) | Lower storage cost, higher access cost |
| Archive | Rarely/never accessed (compliance retention) | Lowest storage cost, highest access cost + retrieval latency |
# Move blobs untouched for 90+ days to Cool tier automaticallyaz storage account management-policy create \ --account-name mystorageaccount \ --policy @lifecycle-policy.json{ "rules": [{ "name": "moveToCool", "type": "Lifecycle", "definition": { "filters": { "blobTypes": ["blockBlob"] }, "actions": { "baseBlob": { "tierToCool": { "daysAfterModificationGreaterThan": 90 } } } } }]}CDN caching
Section titled โCDN cachingโEvery request the CDN serves from cache is a request that never hits Blob Storage or your Function App โ direct, compounding savings:
- Set long
Cache-Controlheaders (max-age=31536000, immutable) on processed images, since theyโre content-hashed and never change in place. - Use a cache-busting filename (hash or version in the path) instead of re-uploading to the same URL โ lets you cache aggressively without ever needing an invalidation.
- Enable CDN compression for text-based assets (JSON, CSS, JS) โ image formats like WebP are already compressed and donโt benefit.
Reducing egress
Section titled โReducing egressโEgress (data leaving Azure) is often the single largest line item for an image-heavy site:
- Serve everything through the CDN, never directly from Blob Storage โ CDN edge egress is priced lower than storage-account egress at volume.
- Generate and serve appropriately-sized images (see automated image processing) instead of shipping a 4000px original and letting the browser downscale it โ you pay egress for every byte, used or not.
- Enable Brotli/Gzip compression at the CDN for compressible content types.
Right-sizing compute
Section titled โRight-sizing computeโ- Azure Functions on a Consumption plan bills per execution โ ideal for bursty, event-driven work like image processing, since idle time costs nothing.
- Static Web Appsโ Free tier covers most personal/small sites; only move to Standard when you actually need private endpoints, larger file size limits, or SLA guarantees โ donโt provision ahead of need.
Monitoring spend
Section titled โMonitoring spendโaz consumption budget create \ --budget-name monthly-storage-budget \ --amount 50 \ --time-grain Monthly \ --category CostSet a budget alert, not just a dashboard โ a silent cost creep is only actionable if something actually notifies you.
Next steps
Section titled โNext stepsโ- Apply a lifecycle policy to your Blob Storage images container
- Confirm your Static Web Apps integration is serving through the CDN, not directly from storage