Azure Media Storage (OrchardCore.Media.Azure)

The Azure Media Storage feature enables support for storing assets in Microsoft Azure Blob Storage.

The feature replaces the default App_Data file based media store with an Azure Media Storage Provider.

Media is still served by the Orchard Core web site, and the Media Cache module takes responsibility for fetching media, on the fly, from the Azure Blob Storage Container.

This allows the Azure Media Storage feature to support image resizing on the fly through integration with ImageSharp.Web.

The url generated by the AssetUrl helpers, points to the Orchard Core web site.

Configuration

The following configuration values are used by default and can be customized:

    "OrchardCore.Media.Azure":
    {
      // Set to your Azure Storage account connection string.
      "ConnectionString": "", 
      // Set to the Azure Blob container name.
      "ContainerName": "somecontainer",
      // Optionally, set to a path to store media in a subdirectory inside your container.
      "BasePath": "some/base/path"
    },

Refer also to the Configuration Section, and the Media Section for other Media related configuration settings.

The Azure Media Storage module will check on Startup for a connection string, and container string.

If these are not present in app_settings.json, it will not enable the feature, and report an error message in the log file.

Note

Orchard Core will not create the Blob Container. It must already exist before enabling Azure Media Storage.

Media Cache

The Media Cache feature will automatically be enabled when Azure Media Storage is enabled.

The Media Cache feature will cache files stored from Azure Blob Storage, to support image resizing.

The Media Cache feature allows Purging of the Media Cache files stored locally.

You might choose to use the Purging feature if you are fronting the media assets with a CDN. After allowing a long enough period of time for the CDN to have fetched a significant amount of Media assets, both resized, and full size, from the Media Cache you might consider purging the cache.

Note

However please bear in mind that your CDN provider will likely have multiple Points of Presence worldwide, and each of these will maintain their own cache, so while a local CDN PoP might have the asset another PoP may not, until it is requested. At this stage the Media Cache will, if necessary, refetch the asset from Azure Blog Storage, on the fly, and provide it to the CDN PoP.

CDN providers also clear their caches at pre-determined times of their own devising, so while CDN’s are a valuable caching and performance asset, it is important that they are always be able to re-fetch the source file, as and when required, which the Media Cache Module will automatically handle.

Note

The Media Feature is designed to support one storage provider at a time, whether that is local File Storage, the default, or Azure Blob Storage.