Skip to content

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.

Blob Storage bills differently depending on access tier, and most sites keep everything in the most expensive one by default:

TierBest forRelative cost
HotFrequently accessed images (site’s active content)Highest storage cost, lowest access cost
CoolInfrequently accessed (archived uploads, old versions)Lower storage cost, higher access cost
ArchiveRarely/never accessed (compliance retention)Lowest storage cost, highest access cost + retrieval latency
Terminal window
# Move blobs untouched for 90+ days to Cool tier automatically
az 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 }
}
}
}
}]
}

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-Control headers (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.

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.
  • 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.
Terminal window
az consumption budget create \
--budget-name monthly-storage-budget \
--amount 50 \
--time-grain Monthly \
--category Cost

Set a budget alert, not just a dashboard β€” a silent cost creep is only actionable if something actually notifies you.