umbraco-packages - UmbracoFileSystemProviders.Azure.Media 3.1.1-alpha-000611

An Azure Blob Storage IFileSystem provider for Umbraco Media.

PM> Install-Package UmbracoFileSystemProviders.Azure.Media -Version 3.1.1-alpha-000611 -Source https://www.myget.org/F/umbraco-packages/api/v3/index.json

Copy to clipboard

> nuget.exe install UmbracoFileSystemProviders.Azure.Media -Version 3.1.1-alpha-000611 -Source https://www.myget.org/F/umbraco-packages/api/v3/index.json

Copy to clipboard

> dotnet add package UmbracoFileSystemProviders.Azure.Media --version 3.1.1-alpha-000611 --source https://www.myget.org/F/umbraco-packages/api/v3/index.json

Copy to clipboard
<PackageReference Include="UmbracoFileSystemProviders.Azure.Media" Version="3.1.1-alpha-000611" />
Copy to clipboard
source https://www.myget.org/F/umbraco-packages/api/v3/index.json

nuget UmbracoFileSystemProviders.Azure.Media  ~> 3.1.1-alpha-000611
Copy to clipboard

> choco install UmbracoFileSystemProviders.Azure.Media --version 3.1.1-alpha-000611 --source https://www.myget.org/F/umbraco-packages/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "umbraco-packages" -SourceLocation "https://www.myget.org/F/umbraco-packages/api/v2"
Install-Module -Name "UmbracoFileSystemProviders.Azure.Media" -RequiredVersion "3.1.1-alpha-000611" -Repository "umbraco-packages" -AllowPreRelease
Copy to clipboard

Browse the sources in this package using Visual Studio or WinDbg by configuring the following legacy symbol server URL: https://www.myget.org/F/umbraco-packages/symbols/


UmbracoFileSystemProviders.Azure v1

This version is for Umbraco v7 only. For the v2 package for Umbraco v8 please visit the develop-umbraco-version-8 branch

Image Alt

Build status

An Azure Blob Storage IFileSystem provider for Umbraco 7.1.9+. Used to offload static files in the media section to the cloud.

Designed to supersede UmbracoAzureBlobStorage by Dirk Seefeld (With his blessing) this package allows the storage and retrieval of media items using Azure Blob Storage while retaining the relative paths to the files expected in the back office.

Installation

Both NuGet and Umbraco packages are available. If you use NuGet but would like the benefit of the Umbraco configuration wizard you can install the Umbraco package first, use the wizard, then install the NuGet package, the configuration will be maintained.

NuGet Packages Version
Release NuGet download NuGet count
Pre-release MyGet download MyGet count
Umbraco Packages
Release Our Umbraco project page
Pre-release AppVeyor Artifacts

Manual build

If you prefer, you can compile UmbracoFileSystemProviders.Azure yourself, you'll need:

  • Visual Studio 2015 (or above)

To clone it locally click the "Clone in Windows" button above or run the following git commands.

git clone https://github.com/JimBobSquarePants/UmbracoFileSystemProviders.Azure
cd UmbracoFileSystemProviders.Azure
.\build.cmd

In the interim code reviews and pull requests would be most welcome!

Usage

Note: Upon release most of configuration this will be automated.

Update ~/Config/FileSystemProviders.config replacing the default provider with the following:

<?xml version="1.0"?>
<FileSystemProviders>
  <Provider alias="media" type="Our.Umbraco.FileSystemProviders.Azure.AzureBlobFileSystem, Our.Umbraco.FileSystemProviders.Azure">
    <Parameters>
      <add key="containerName" value="media" />
      <add key="rootUrl" value="https://[myAccountName].blob.core.windows.net/" />
      <add key="connectionString" value="DefaultEndpointsProtocol=https;AccountName=[myAccountName];AccountKey=[myAccountKey]"/>
      <!--
        Optional configuration value determining the maximum number of days to cache items in the browser.
        Defaults to 365 days.
      -->
      <add key="maxDays" value="365" />
      <!--
        When true this allows the VirtualPathProvider to use the default "media" route prefix regardless 
        of the container name.
      -->
      <add key="useDefaultRoute" value="true" />
      <!--
        When true blob containers will be private instead of public what means that you can't access the original blob file directly from its blob url.
      -->
      <add key="usePrivateContainer" value="false" />
    </Parameters>
  </Provider>
</FileSystemProviders>

Developmental mode configuration using the Azure Storage Emulator for testing is as follows:

<?xml version="1.0"?>
<FileSystemProviders>
  <Provider alias="media" type="Our.Umbraco.FileSystemProviders.Azure.AzureBlobFileSystem, Our.Umbraco.FileSystemProviders.Azure">
    <Parameters>
      <add key="containerName" value="media" />
      <add key="rootUrl" value="http://127.0.0.1:10000/devstoreaccount1/" />
      <add key="connectionString" value="UseDevelopmentStorage=true"/>
    </Parameters>
  </Provider>
</FileSystemProviders>

Additionally the provider can be further configured with the following application setting in the web.config.

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <!--Disables the built in Virtual Path Provider which allows for relative paths-->
    <add key="AzureBlobFileSystem.DisableVirtualPathProvider" value="true" />
    <!--
      Enables the development mode for testing. Addition changes to the FileSystemProviders.config are also required
    -->
    <add key="AzureBlobFileSystem.UseStorageEmulator" value="true" />
  </appSettings>
</configuration>

Configuration via Web.Config

Available in v0.5.4+

Optionally instead of having the configuration in FileSystemProviders.config it can be moved to Web.config

In FileSystemProviders.config remove the default parameters and add a new one with the key alias, the value should match the provider alias

<?xml version="1.0"?>
<FileSystemProviders>
  
  <!-- Media -->
  <Provider alias="media" type="Our.Umbraco.FileSystemProviders.Azure.AzureBlobFileSystem, Our.Umbraco.FileSystemProviders.Azure">
  	<Parameters>
  		<add key="alias" value="media"/>
  	</Parameters>
  </Provider>
   
</FileSystemProviders>

In Web.config create the new application keys and post fix each key with the alias defined in FileSystemProviders.config after a colon.

<add key="AzureBlobFileSystem.ConnectionString:media" value="DefaultEndpointsProtocol=https;AccountName=[myAccountName];AccountKey=[myAccountKey]" />
<add key="AzureBlobFileSystem.ContainerName:media" value="media" />
<add key="AzureBlobFileSystem.RootUrl:media" value="https://[myAccountName].blob.core.windows.net/" />
<add key="AzureBlobFileSystem.MaxDays:media" value="365" />
<add key="AzureBlobFileSystem.UseDefaultRoute:media" value="true" />
<add key="AzureBlobFileSystem.UsePrivateContainer:media" value="false" />

Configuration for Azure Key Vault

For Azure Key Vault only the key values in the Web.config should use '-', rather than a '.' or ':' as shown below

<add key="AzureBlobFileSystem-ConnectionString-media" value="DefaultEndpointsProtocol=https;AccountName=[myAccountName];AccountKey=[myAccountKey]" />
<add key="AzureBlobFileSystem-ContainerName-media" value="media" />
<add key="AzureBlobFileSystem-RootUrl-media" value="https://[myAccountName].blob.core.windows.net/" />
<add key="AzureBlobFileSystem-MaxDays-media" value="365" />
<add key="AzureBlobFileSystem-UseDefaultRoute-media" value="true" />
<add key="AzureBlobFileSystem-UsePrivateContainer-media" value="false" />

Virtual Path Provider

By default the plugin will serve files transparently from your domain or serve media directly from Azure. This is made possible by using a custom Virtual Path Provider included and automatically initialised upon application startup. This can be disable by adding the configuration setting noted above.

Note: Virtual Path Providers may affect performance/caching depending on your setup as the process differs from IIS's unmanaged handler. Virtual files sent via the provider though are correctly cached in the browser so this shouldn't be an issue. VVP providers also don't work with Precompiled sites or when used in a virtual directory/application.

The following configuration is required in your web.config to enable static file mapping in IIS Express.

<?xml version="1.0"?>
  <configuration>
    <location path="Media">
      <system.webServer>
        <handlers>
          <remove name="StaticFileHandler" />
          <add name="StaticFileHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.StaticFileHandler" />
        </handlers>
      </system.webServer>
    </location>
  </configuration>

For Umbraco v7.5+ you must add the the StaticFileHandler to the new Web.config inside the Media folder instead of the root one or the VPP will not work!

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
	<system.webServer>
		<handlers>
			<clear />
			<add name="StaticFileHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.StaticFileHandler" />
			<add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" />
		</handlers>
	</system.webServer>
</configuration>

Combining with ImageProcessor

As of ImageProcessor.Web version 4.3.2 a new IImageService implementation has been available called CloudImageService. To enable that service and pull images directly from the cloud simply install the configuration package and replace the CloudImageServicesetting with the following:

<?xml version="1.0"?>
<security>
  <services>
    <service name="LocalFileImageService" type="ImageProcessor.Web.Services.LocalFileImageService, ImageProcessor.Web"/>
    <service prefix="media/" name="CloudImageService" type="ImageProcessor.Web.Services.CloudImageService, ImageProcessor.Web">
      <settings>
        <setting key="MaxBytes" value="8194304"/>
        <setting key="Timeout" value="30000"/>
        <setting key="Host" value="https://[myAccountName].blob.core.windows.net/media/"/>
      </settings>
    </service>
  </services>  
</security>

Note The CloudImageServiceis not compatible with the FileSystemProvider when using private storage. You will have to build your own IImageService implementation.

If using a version of ImageProcessor.Web version 4.5.0 the configuration details will need to be configured as follows:

<?xml version="1.0"?>
<security>
  <services>
    <service name="LocalFileImageService" type="ImageProcessor.Web.Services.LocalFileImageService, ImageProcessor.Web"/>
    <service prefix="media/" name="CloudImageService" type="ImageProcessor.Web.Services.CloudImageService, ImageProcessor.Web">
      <settings>
        <setting key="Container" value="media"/>
        <setting key="MaxBytes" value="8194304"/>
        <setting key="Timeout" value="30000"/>
        <setting key="Host" value="https://[myAccountName].blob.core.windows.net/media"/>
      </settings>
    </service>
  </services>  
</security>

Be sure to install the AzureBlobCache plugin to get the most out of the package.

Authors

  • James Jackson-South
  • Dirk Seefeld
  • Lars-Erik Aabech
  • Jeavon Leopold

Thanks

  • Elijah Glover for writing the Umbraco S3 Provider which provided inspiration and some snazzy unit testing code for this project.
  • Any 0.0
    • UmbracoCms.Core (>= 8.18.5 && < 9.0.0)
    • UmbracoCms.Web (>= 8.18.5 && < 9.0.0)
    • UmbracoFileSystemProviders.Azure (>= 3.1.1-alpha-000611)
  • .NETFramework 4.7.2: 4.7.2.0

                        
Assembly Assembly hash Match
/lib/net472/our.umbraco.filesystemproviders.azure.media.dll 4001f20c95744097ba0f9e7fcc1ecb65FFFFFFFF

Owners

Jeavon Leopold

Authors

James Jackson-South, Dirk Seefeld, Lars-Erik Aabech, Jeavon Leopold, Warren Buckley, Callum Whyte, Sebastiaan Janssen, Rachel Breeze, Shannon Deminick, Chad Currie

Project URL

https://github.com/umbraco-community/UmbracoFileSystemProviders.Azure

License

Apache-2.0

Tags

umbraco azure media blob imageprocessor

Info

168 total downloads
3 downloads for version 3.1.1-alpha-000611
Download (7.58 KB)
Download legacy symbols (14.49 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
3.1.1-alpha-000611 7.58 KB Tue, 18 Jul 2023 16:12:06 GMT 3
3.1.0-alpha-000602 7.58 KB Tue, 18 Jul 2023 15:47:06 GMT 3
3.1.0-alpha-000599 7.58 KB Tue, 18 Jul 2023 15:23:10 GMT 3
3.1.0-alpha-000596 7.58 KB Tue, 18 Jul 2023 14:49:35 GMT 3
3.1.0-alpha-000571 7.58 KB Tue, 04 Oct 2022 15:56:44 GMT 3
3.0.3-alpha-000550 7.58 KB Thu, 04 Aug 2022 09:07:54 GMT 2
3.0.3-alpha-000541 7.58 KB Thu, 14 Jul 2022 16:15:18 GMT 2
3.0.3-alpha-000527 7.58 KB Thu, 11 Nov 2021 16:23:07 GMT 5
3.0.3-alpha-000523 7.58 KB Thu, 11 Nov 2021 16:12:04 GMT 5
3.0.3-alpha-000520 7.58 KB Wed, 10 Nov 2021 22:00:05 GMT 2
3.0.2 7.56 KB Thu, 11 Nov 2021 16:18:22 GMT 5
3.0.2-alpha-000524 7.58 KB Thu, 11 Nov 2021 16:15:31 GMT 3
3.0.2-alpha-000517 7.58 KB Thu, 04 Nov 2021 14:40:30 GMT 2
3.0.2-alpha-000513 7.58 KB Wed, 22 Sep 2021 16:27:20 GMT 2
3.0.1-alpha-000510 7.58 KB Tue, 21 Sep 2021 15:59:51 GMT 3
3.0.1-alpha-000508 7.58 KB Mon, 20 Sep 2021 15:24:13 GMT 3
3.0.1-alpha-000507 7.58 KB Thu, 16 Sep 2021 15:06:21 GMT 3
3.0.1-alpha-000506 7.58 KB Thu, 16 Sep 2021 14:47:24 GMT 3
3.0.1-alpha-000501 7.58 KB Thu, 16 Sep 2021 11:03:24 GMT 4
3.0.1-alpha-000500 7.58 KB Wed, 15 Sep 2021 17:26:42 GMT 2
3.0.0-beta3-000499 7.58 KB Wed, 15 Sep 2021 17:24:43 GMT 3
3.0.0-beta3-000496 7.58 KB Wed, 15 Sep 2021 17:12:41 GMT 2
3.0.0-beta3-000492 7.58 KB Wed, 15 Sep 2021 16:14:27 GMT 2
3.0.0-beta3-000478 7.58 KB Wed, 15 Sep 2021 12:59:34 GMT 1
3.0.0-beta3-000473 7.58 KB Wed, 15 Sep 2021 12:45:55 GMT 1
3.0.0-beta3-000472 7.58 KB Wed, 15 Sep 2021 12:24:29 GMT 2
3.0.0-beta3-000466 7.45 KB Thu, 09 Sep 2021 10:49:15 GMT 3
3.0.0-beta3-000464 7.45 KB Thu, 02 Sep 2021 09:20:39 GMT 1
3.0.0-beta3-000461 7.44 KB Thu, 02 Sep 2021 08:58:15 GMT 1
3.0.0-beta2-000457 7.44 KB Tue, 31 Aug 2021 12:49:28 GMT 1
3.0.0-beta2-000454 7.44 KB Tue, 31 Aug 2021 12:14:20 GMT 1
3.0.0-beta2-000435 7.44 KB Tue, 18 May 2021 10:19:38 GMT 1
3.0.0-beta1-000432 7.44 KB Tue, 18 May 2021 09:53:19 GMT 2
3.0.0-beta1-000431 7.44 KB Tue, 18 May 2021 09:50:09 GMT 2
3.0.0-beta1 7.43 KB Tue, 18 May 2021 10:07:44 GMT 1
3.0.0-alpha-000430 7.44 KB Tue, 18 May 2021 09:07:18 GMT 3
3.0.0-alpha-000428 7.45 KB Tue, 18 May 2021 08:28:43 GMT 4
2.1.0-alpha-000509 7.44 KB Tue, 21 Sep 2021 11:32:22 GMT 1
2.1.0-alpha-000491 7.44 KB Wed, 15 Sep 2021 15:58:15 GMT 1
2.1.0-alpha-000479 7.45 KB Wed, 15 Sep 2021 13:07:21 GMT 1
2.1.0-alpha-000444 7.44 KB Wed, 14 Jul 2021 12:17:18 GMT 1
2.1.0-alpha-000437 7.44 KB Tue, 18 May 2021 10:31:25 GMT 1
2.1.0-alpha-000429 7.44 KB Tue, 18 May 2021 08:33:02 GMT 1
2.1.0-alpha-000424 7.44 KB Tue, 06 Apr 2021 16:15:12 GMT 3
2.0.2-alpha-000423 7.44 KB Tue, 06 Apr 2021 16:13:13 GMT 2
2.0.2-alpha-000421 9.13 KB Tue, 06 Apr 2021 12:22:08 GMT 1
2.0.2-alpha-000418 9.12 KB Tue, 23 Mar 2021 14:53:09 GMT 1
2.0.1-alpha-000415 9.13 KB Tue, 23 Mar 2021 13:49:12 GMT 1
2.0.1-alpha-000414 9.13 KB Tue, 23 Mar 2021 13:41:08 GMT 1
2.0.1-alpha-000413 9.12 KB Tue, 23 Mar 2021 13:37:39 GMT 2
2.0.1-alpha-000405 9.12 KB Wed, 04 Mar 2020 11:02:53 GMT 2
2.0.1-alpha-000401 9.13 KB Fri, 28 Feb 2020 19:36:06 GMT 1
2.0.0-beta3-000396 9.12 KB Wed, 19 Feb 2020 15:13:55 GMT 1
2.0.0-beta2-000393 9.13 KB Wed, 19 Feb 2020 10:23:06 GMT 1
2.0.0-beta2-000386 9.12 KB Mon, 10 Feb 2020 09:50:20 GMT 1
2.0.0-beta2-000385 9.12 KB Mon, 10 Feb 2020 09:42:37 GMT 2
2.0.0-beta1-000382 9.12 KB Mon, 10 Feb 2020 09:21:03 GMT 1
2.0.0-alpha6-000381 9.13 KB Mon, 03 Feb 2020 12:42:03 GMT 2
2.0.0-alpha6-000374 9.12 KB Tue, 28 Jan 2020 10:27:07 GMT 2
2.0.0-alpha6-000372 9.13 KB Mon, 02 Dec 2019 16:43:35 GMT 4
2.0.0-alpha6-000371 9.13 KB Mon, 02 Dec 2019 16:12:33 GMT 1
2.0.0-alpha5-000368 9.12 KB Thu, 28 Nov 2019 11:57:27 GMT 2
2.0.0-alpha5-000367 9.13 KB Thu, 28 Nov 2019 11:54:18 GMT 1
2.0.0-alpha5-000359 9.13 KB Mon, 28 Oct 2019 15:52:49 GMT 5
2.0.0-alpha4-000356 9.12 KB Mon, 28 Oct 2019 15:46:18 GMT 2
2.0.0-alpha4-000353 9.13 KB Tue, 22 Oct 2019 12:49:17 GMT 2
2.0.0-alpha4-000350 9.12 KB Tue, 22 Oct 2019 12:03:06 GMT 1
2.0.0-alpha4-000347 9.12 KB Fri, 18 Oct 2019 15:16:48 GMT 2
2.0.0-alpha4-000346 9.12 KB Mon, 16 Sep 2019 16:25:38 GMT 3
2.0.0-alpha3-000345 9.13 KB Mon, 16 Sep 2019 16:20:28 GMT 2
2.0.0-alpha3-000344 9.13 KB Thu, 29 Aug 2019 14:59:01 GMT 3
2.0.0-alpha3-000340 9.13 KB Thu, 29 Aug 2019 12:28:05 GMT 2
2.0.0-alpha3-000339 9.12 KB Tue, 13 Aug 2019 10:43:04 GMT 10
2.0.0-alpha3-000337 9.12 KB Tue, 13 Aug 2019 10:32:09 GMT 1
2.0.0-alpha3-000336 9.12 KB Tue, 13 Aug 2019 10:02:18 GMT 3
2.0.0-alpha3-000335 9.12 KB Tue, 13 Aug 2019 09:56:42 GMT 1
2.0.0-alpha3-000334 9.12 KB Tue, 13 Aug 2019 09:49:03 GMT 1