[Umbraco 13] Make Azure Blob Storage prefix configurable in Umbraco.StorageProviders

I’d like to propose a feature to make the Azure Blob Storage path prefix configurable in the Umbraco.StorageProviders.AzureBlob package. This would greatly help with migrations from older Umbraco versions and support more flexible cloud storage architectures.

The Challenge: Hardcoded /media/ Prefix

Currently, Umbraco.StorageProviders.AzureBlob hardcodes the /media/ prefix for all stored files. This means every media item has a path like /media/[subfolder]/filename.jpg.

This rigid approach creates significant challenges for organizations like ours that:

  • Are migrating from Umbraco 7: We are migrating over 150 environments where a custom storage provider stored files directly in the container root. Without a configurable prefix, all existing media URLs will break.

  • Have existing storage structures: Our established Azure Blob Storage setup does not use the /media/ prefix, and migrating hundreds of containers is not feasible.

  • Utilize different container strategies: The provider assumes a single container with subfolders. We, however, use separate containers for different purposes (e.g., one for media, another for cache), and the prefix is an unnecessary level of nesting.

Proposed Solutions

I see two potential ways to solve this:

Option 1: Add a Configurable Prefix

The most direct solution would be to add a Prefix property to the appsettings.json configuration. This would allow developers to set a custom value or an empty string to use the container root.

Example appsettings.json:

JSON

{
  "Umbraco": {
    "Storage": {
      "AzureBlob": {
        "Media": {
          "ConnectionString": "...",
          "ContainerName": "media",
          "Prefix": "" // Allow an empty string or a custom prefix
        }
      }
    }
  }
}

Option 2: Provide Better Extensibility

Alternatively, providing better extension points in the storage provider would also work. For example, if the methods for path generation were virtual, we could inherit from the provider and override the path logic without having to re-implement the entire IFileSystem interface.

Why This is Needed

Our goal is to stay as close to the core Umbraco codebase as possible to ensure smooth future upgrades. Forcing developers to implement a completely custom IFileSystem for a minor pathing difference increases maintenance overhead and risk.

I believe this enhancement would benefit many others migrating from older Umbraco versions or those with enterprise-level Azure setups that don’t align with the current hardcoded assumption.

Environment Details

  • Umbraco version: 13.8.1 with Umbraco.StorageProviders version: 13.0.0

  • Migration from: Umbraco 7 with a custom Azure Blob provider

Has anyone else run into this? We would appreciate any thoughts on the best approach or any temporary workarounds we might have missed!

1 Like