Skip to content
  • English Deutsch

benjamin-abt.com

Performance is a feature | Cloud - AI - Azure - .NET - Sustainability

  • Home
  • Blog
  • Portfolio
    • Overview
    • Workshops & Training
    • Publications
  • Contact
  • Home
  • Blog

Update Azure Storage Blob Properties with PowerShell

Update Azure Storage Blob Properties with PowerShell
May 3, 2019 2 min read BEN ABT
Azure

This article was written in 2019. Versions, tools and recommendations may have changed since then. Newer posts are collected under Azure.

In the past days I uploaded a lot of files to an Azure Blob Storage using the Azure Storage Explorer.

Unfortunately, I forgot to specify system properties such as cache content when uploading to Azure Storage Explorer. Currently the only option here is the Azure CLI and the “upload-batch” command. The files were already uploaded in the meantime, so I didn’t want to do the upload again.

Unfortunately, there is currently no command in the Azure Storage Explorer and the Azure CLI to update system properties such as cache content with a one-liner.

So I wrote myself a PowerShell script that reads all the blob storage items, filters for file extensions and updates the cache content.

PowerShell
 1# Storage Settings
 2$storageAccount = "__storage account__";
 3$containerName = "__container name__";
 4
 5# Blob Update Settings
 6$contentCacheControl = "public, max-age=2592000"; # 30 days
 7$extensions = @(".gif", ".jpg", ".jpeg", ".ico", ".png", ".css", ".js");
 8
 9# Read all blobs
10$blobs = az storage blob list --account-name $storageAccount --container-name $containerName --num-results * --output json | ConvertFrom-Json
11
12# iterate all blobs
13foreach($blob in $blobs)
14{
15    # use name as identifier
16    $blobName = $blob.name;
17
18    # get extension
19    $extension = [System.IO.Path]::GetExtension($blobName).ToLower();
20 
21    # update blob if extension is affected
22    if($extensions.Contains($extension))
23    {
24        az storage blob update --account-name $storageAccount --container-name $containerName --name $blobName --content-cache-control $contentCacheControl
25        Write-Host "Updated $blobName" 
26    }
27}

Azure CLI - Upload Batch

During my research I also found the upload-batch command, with which I could have specified this directly during the upload.

Shell
az storage blob upload-batch --account-name $storageAccount --destination $containerName --source C:\your\local\folder --content-cache-control "public, max-age=2592000"

Related articles

Automatic TTL in Azure Cosmos DB with .NET

Aug 17, 2026 - 17 min read

Automatic TTL in Azure Cosmos DB with .NET

Temporary data is easy to create and surprisingly difficult to remove reliably. Sessions, idempotency keys, import buffers, transient …

Run Hono on Azure Static Web Apps: managed Functions APIs for static frontends

Jul 19, 2026 - 8 min read

Run Hono on Azure Static Web Apps: managed Functions APIs for static frontends

Azure Static Web Apps is primarily a host for static frontend assets, but it can also deploy a small HTTP API alongside the frontend. That …

Run Hono on Azure: Container Apps, Functions, App Service and AKS compared

Jul 12, 2026 - 14 min read

Run Hono on Azure: Container Apps, Functions, App Service and AKS compared

Hono is often associated with Cloudflare Workers and for good reason. Its small routing model, Web Standard API surface and direct fetch …


BEN ABT

BEN ABT

Ben is Chief Engineering Officer and Principal Software Engineer at Medialesson.de, with a strong focus on .NET and Microsoft Azure. In his professional role, he designs and builds highly scalable platforms for hybrid and cloud-based scenarios. He also advises companies and C-levels on migrating to the sovereign cloud.

He runs myCSharp.de, the largest and most active German-speaking C# community forum, actively contributes to both his own and external open-source projects and regularly shares his knowledge through his blog, at community events, conferences and as a writer for technical magazines.

Let's Work Together

Looking for an experienced Platform Architect or Engineer for your next project? Whether it's cloud migration, platform modernization or building new solutions from scratch - I'm here to help you succeed.

New Platforms

Modernization

Training & Consulting

Contact Me
X Facebook LinkedIn WhatsApp
Back Next Blog Post

Open for work!

Contact Me
BEN ABT BEN ABT Software Engineer · Microsoft MVP Passionate about .NET, Azure, performance optimization and sustainable software engineering.

Medialesson GmbH Logo

Microsoft MVP Logo

Recent posts

View all
Stop Using nginx as Your Default Static File Server in Docker

Stop Using nginx as Your Default Static File Server in …

Oct 24, 2026
Containerizing .NET in 2026 Without a Dockerfile

Containerizing .NET in 2026 Without a Dockerfile

Oct 20, 2026
Problem Details in ASP.NET Core and .NET 11

Problem Details in ASP.NET Core and .NET 11

Oct 5, 2026
Resilience in .NET with Microsoft.Extensions.Resilience

Resilience in .NET with Microsoft.Extensions.Resilience

Sep 21, 2026
What Matters in ASP.NET Core 11

What Matters in ASP.NET Core 11

Sep 14, 2026

Tags

.NET (192) Csharp (96) ASP.NET Core (48) Azure (41) DevOps (17) Docker (14) Microsoft (14) EF Core (11) Microsoft MVP (11) AI (10) GitHub (10) GitHub Copilot (10) ASP.NET (9) Security (9) Synology (9) Architecture (8) Raspberry (8) Azure Functions (7) Cloudflare (7) Bicep (6)
benjamin-abt.com

About BEN

Benjamin Abt is a Software Engineer, Platform Architect and Microsoft MVP specializing in .NET, Azure, cloud architecture, performance optimization and sustainable software development.

Connect

  • Follow me on GitHub
  • Follow me on LinkedIn
  • Follow me on Mastodon
  • Microsoft MVP profile
  • Follow SchwabenCode on GitHub
  • Follow me on X

Quick Links

  • Portfolio
  • Blog
  • Workshops & Training
  • Publications
  • Get in Touch
  • Sitemap
Open for Work

© Copyright Benjamin Abt & SchwabenCode | 2011 - 2026

Content licensed under CC BY 4.0 unless otherwise noted.

  • Impressum
  • Privacy
  • Contact