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 image processing workflows) 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