umbraco-packages - UmbracoFileSystemProviders.Azure 3.0.0-alpha-000430

An Azure Blob Storage IFileSystem provider for Umbraco.

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

Copy to clipboard

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

Copy to clipboard

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

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

nuget UmbracoFileSystemProviders.Azure  ~> 3.0.0-alpha-000430
Copy to clipboard

> choco install UmbracoFileSystemProviders.Azure --version 3.0.0-alpha-000430 --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" -RequiredVersion "3.0.0-alpha-000430" -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
    • Azure.Core (>= 1.14.0)
    • Azure.Storage.Blobs (>= 12.8.3)
    • Azure.Storage.Common (>= 12.7.2)
    • Microsoft.Azure.ConfigurationManager (>= 4.0.0)
    • Microsoft.Azure.KeyVault.Core (>= 3.0.3)
    • Microsoft.Data.Services.Client (>= 5.8.4)
    • UmbracoCms.Core (>= 8.1.0)
    • UmbracoCms.Web (>= 8.1.0)
  • .NETFramework 4.7.2: 4.7.2.0

                        
Assembly Assembly hash Match
/lib/net472/our.umbraco.filesystemproviders.azure.dll 74a9c51ceafc4d119974fa503ec860a91

Owners

Jeavon Leopold

Authors

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

Project URL

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

License

Apache-2.0

Tags

umbraco azure media blob imageprocessor

Info

734 total downloads
2 downloads for version 3.0.0-alpha-000430
Download (14.2 KB)
Download legacy symbols (44.51 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
3.1.1-alpha-000611 14.39 KB Tue, 18 Jul 2023 16:12:01 GMT 2
3.1.0-alpha-000602 14.4 KB Tue, 18 Jul 2023 15:47:00 GMT 2
3.1.0-alpha-000599 14.4 KB Tue, 18 Jul 2023 15:23:03 GMT 4
3.1.0-alpha-000596 14.38 KB Tue, 18 Jul 2023 14:49:29 GMT 3
3.1.0-alpha-000571 14.37 KB Tue, 04 Oct 2022 15:56:39 GMT 3
3.0.3-alpha-000550 14.37 KB Thu, 04 Aug 2022 09:07:46 GMT 3
3.0.3-alpha-000541 14.37 KB Thu, 14 Jul 2022 16:15:13 GMT 2
3.0.3-alpha-000527 14.37 KB Thu, 11 Nov 2021 16:23:02 GMT 4
3.0.3-alpha-000523 14.37 KB Thu, 11 Nov 2021 16:11:59 GMT 2
3.0.3-alpha-000520 14.35 KB Wed, 10 Nov 2021 22:00:00 GMT 2
3.0.2 14.32 KB Thu, 11 Nov 2021 16:18:11 GMT 4
3.0.2-alpha-000524 14.37 KB Thu, 11 Nov 2021 16:15:27 GMT 2
3.0.2-alpha-000517 14.34 KB Thu, 04 Nov 2021 14:40:24 GMT 3
3.0.2-alpha-000513 14.34 KB Wed, 22 Sep 2021 16:27:15 GMT 2
3.0.1-alpha-000510 14.34 KB Tue, 21 Sep 2021 15:59:45 GMT 3
3.0.1-alpha-000508 14.28 KB Mon, 20 Sep 2021 15:24:07 GMT 2
3.0.1-alpha-000507 14.28 KB Thu, 16 Sep 2021 15:06:16 GMT 3
3.0.1-alpha-000506 14.28 KB Thu, 16 Sep 2021 14:47:19 GMT 2
3.0.1-alpha-000501 14.28 KB Thu, 16 Sep 2021 11:03:19 GMT 2
3.0.1-alpha-000500 14.27 KB Wed, 15 Sep 2021 17:26:37 GMT 4
3.0.0-beta3-000499 14.28 KB Wed, 15 Sep 2021 17:24:38 GMT 2
3.0.0-beta3-000496 14.28 KB Wed, 15 Sep 2021 17:12:36 GMT 3
3.0.0-beta3-000492 14.28 KB Wed, 15 Sep 2021 16:14:22 GMT 4
3.0.0-beta3-000478 14.28 KB Wed, 15 Sep 2021 12:59:29 GMT 2
3.0.0-beta3-000473 14.28 KB Wed, 15 Sep 2021 12:45:50 GMT 1
3.0.0-beta3-000472 14.28 KB Wed, 15 Sep 2021 12:24:25 GMT 2
3.0.0-beta3-000466 14.15 KB Thu, 09 Sep 2021 10:49:09 GMT 3
3.0.0-beta3-000464 14.15 KB Thu, 02 Sep 2021 09:20:34 GMT 1
3.0.0-beta3-000461 14.14 KB Thu, 02 Sep 2021 08:58:07 GMT 1
3.0.0-beta2-000457 14.14 KB Tue, 31 Aug 2021 12:49:23 GMT 1
3.0.0-beta2-000454 14.21 KB Tue, 31 Aug 2021 12:14:13 GMT 1
3.0.0-beta2-000435 14.21 KB Tue, 18 May 2021 10:19:33 GMT 3
3.0.0-beta1-000432 14.2 KB Tue, 18 May 2021 09:53:14 GMT 1
3.0.0-beta1-000431 14.21 KB Tue, 18 May 2021 09:50:05 GMT 1
3.0.0-beta1 14.18 KB Tue, 18 May 2021 10:07:38 GMT 2
3.0.0-alpha-000430 14.2 KB Tue, 18 May 2021 09:07:13 GMT 2
3.0.0-alpha-000428 14.2 KB Tue, 18 May 2021 08:28:38 GMT 3
2.1.0-alpha-000509 14.35 KB Tue, 21 Sep 2021 11:32:17 GMT 2
2.1.0-alpha-000491 14.35 KB Wed, 15 Sep 2021 15:58:10 GMT 1
2.1.0-alpha-000479 14.35 KB Wed, 15 Sep 2021 13:07:14 GMT 2
2.1.0-alpha-000444 14.35 KB Wed, 14 Jul 2021 12:17:13 GMT 1
2.1.0-alpha-000437 14.35 KB Tue, 18 May 2021 10:31:21 GMT 1
2.1.0-alpha-000429 14.35 KB Tue, 18 May 2021 08:32:57 GMT 2
2.1.0-alpha-000424 14.35 KB Tue, 06 Apr 2021 16:15:07 GMT 7
2.0.2-alpha-000423 14.34 KB Tue, 06 Apr 2021 16:13:09 GMT 2
2.0.2-alpha-000421 12.97 KB Tue, 06 Apr 2021 12:22:03 GMT 1
2.0.2-alpha-000418 12.97 KB Tue, 23 Mar 2021 14:53:04 GMT 2
2.0.1-alpha-000415 12.97 KB Tue, 23 Mar 2021 13:49:08 GMT 1
2.0.1-alpha-000414 12.97 KB Tue, 23 Mar 2021 13:41:03 GMT 1
2.0.1-alpha-000413 12.92 KB Tue, 23 Mar 2021 13:37:34 GMT 2
2.0.1-alpha-000405 12.92 KB Wed, 04 Mar 2020 11:02:49 GMT 5
2.0.1-alpha-000401 12.92 KB Fri, 28 Feb 2020 19:36:02 GMT 2
2.0.0-beta3-000396 12.91 KB Wed, 19 Feb 2020 15:13:51 GMT 2
2.0.0-beta2-000393 12.92 KB Wed, 19 Feb 2020 10:23:02 GMT 3
2.0.0-beta2-000386 12.9 KB Mon, 10 Feb 2020 09:50:15 GMT 4
2.0.0-beta2-000385 12.9 KB Mon, 10 Feb 2020 09:42:29 GMT 2
2.0.0-beta1-000382 12.91 KB Mon, 10 Feb 2020 09:20:57 GMT 3
2.0.0-alpha6-000381 12.9 KB Mon, 03 Feb 2020 12:41:59 GMT 4
2.0.0-alpha6-000374 12.9 KB Tue, 28 Jan 2020 10:27:03 GMT 3
2.0.0-alpha6-000372 12.92 KB Mon, 02 Dec 2019 16:43:31 GMT 5
2.0.0-alpha6-000371 12.91 KB Mon, 02 Dec 2019 16:12:28 GMT 2
2.0.0-alpha5-000368 12.91 KB Thu, 28 Nov 2019 11:57:23 GMT 3
2.0.0-alpha5-000367 12.8 KB Thu, 28 Nov 2019 11:54:13 GMT 2
2.0.0-alpha5-000359 12.79 KB Mon, 28 Oct 2019 15:52:44 GMT 5
2.0.0-alpha4-000356 12.79 KB Mon, 28 Oct 2019 15:46:13 GMT 3
2.0.0-alpha4-000353 12.47 KB Tue, 22 Oct 2019 12:49:12 GMT 3
2.0.0-alpha4-000350 12.46 KB Tue, 22 Oct 2019 12:03:01 GMT 3
2.0.0-alpha4-000347 12.47 KB Fri, 18 Oct 2019 15:16:44 GMT 2
2.0.0-alpha4-000346 12.47 KB Mon, 16 Sep 2019 16:25:33 GMT 2
2.0.0-alpha3-000345 12.47 KB Mon, 16 Sep 2019 16:20:23 GMT 2
2.0.0-alpha3-000344 11.98 KB Thu, 29 Aug 2019 14:58:55 GMT 5
2.0.0-alpha3-000340 11.98 KB Thu, 29 Aug 2019 12:27:59 GMT 4
2.0.0-alpha3-000339 11.98 KB Tue, 13 Aug 2019 10:42:59 GMT 14
2.0.0-alpha3-000337 11.98 KB Tue, 13 Aug 2019 10:32:04 GMT 3
2.0.0-alpha3-000336 11.98 KB Tue, 13 Aug 2019 10:02:13 GMT 6
2.0.0-alpha3-000335 11.98 KB Tue, 13 Aug 2019 09:56:39 GMT 3
2.0.0-alpha3-000334 11.98 KB Tue, 13 Aug 2019 09:48:59 GMT 3
2.0.0-alpha3-000322 16.49 KB Wed, 17 Jul 2019 08:52:58 GMT 6
2.0.0-alpha3-000321 16.49 KB Wed, 17 Jul 2019 08:46:23 GMT 5
2.0.0-alpha3-000318 16.49 KB Tue, 16 Jul 2019 14:52:54 GMT 5
2.0.0-alpha3-000317 16.49 KB Tue, 16 Jul 2019 11:44:40 GMT 6
2.0.0-alpha3-000316 16.49 KB Tue, 16 Jul 2019 11:38:30 GMT 3
2.0.0-alpha3-000315 16.49 KB Tue, 16 Jul 2019 11:25:51 GMT 5
2.0.0-alpha3-000314 16.5 KB Tue, 16 Jul 2019 10:53:51 GMT 4
2.0.0-alpha3-000313 16.49 KB Tue, 16 Jul 2019 10:08:57 GMT 5
2.0.0-alpha3-000312 16.49 KB Mon, 15 Jul 2019 13:47:25 GMT 4
2.0.0-alpha3-000311 16.49 KB Mon, 15 Jul 2019 13:38:51 GMT 3
2.0.0-alpha3-000306 16.48 KB Thu, 11 Jul 2019 16:01:53 GMT 3
2.0.0-alpha3-000304 16.46 KB Tue, 09 Jul 2019 15:25:21 GMT 3
2.0.0-alpha3-000303 18.96 KB Tue, 14 May 2019 16:28:19 GMT 8
2.0.0-alpha2-000299 18.96 KB Thu, 09 May 2019 12:20:16 GMT 4
2.0.0-alpha1-000298 18.97 KB Thu, 09 May 2019 11:41:44 GMT 6
2.0.0-alpha1-000296 18.97 KB Mon, 08 Apr 2019 09:20:55 GMT 7
2.0.0-alpha1-000294 18.97 KB Mon, 08 Apr 2019 09:13:05 GMT 5
2.0.0-alpha1-000291 18.97 KB Mon, 08 Apr 2019 08:51:04 GMT 6
2.0.0-alpha1-000290 18.97 KB Mon, 08 Apr 2019 08:49:28 GMT 5
2.0.0-alpha-000289 18.97 KB Fri, 05 Apr 2019 11:40:55 GMT 6
2.0.0-alpha-000288 18.96 KB Fri, 05 Apr 2019 09:57:51 GMT 5
2.0.0-alpha-000287 18.97 KB Fri, 05 Apr 2019 09:56:02 GMT 6
2.0.0-alpha-000286 18.97 KB Fri, 05 Apr 2019 09:13:50 GMT 9
1.2.1-alpha-000488 16.37 KB Wed, 15 Sep 2021 15:21:55 GMT 1
1.2.1-alpha-000487 16.36 KB Wed, 15 Sep 2021 15:14:58 GMT 1
1.2.1-alpha-000480 16.35 KB Wed, 15 Sep 2021 13:09:36 GMT 1
1.2.1-alpha-000449 16.35 KB Wed, 14 Jul 2021 12:44:27 GMT 1
1.2.0 16.32 KB Wed, 14 Jul 2021 12:30:11 GMT 383
1.2.0-alpha-1-alpha-000485 16.36 KB Wed, 15 Sep 2021 13:43:00 GMT 1
1.2.0-alpha-000446 16.35 KB Wed, 14 Jul 2021 12:26:30 GMT 1
1.2.0-alpha-000445 16.29 KB Wed, 14 Jul 2021 12:24:43 GMT 1
1.2.0-alpha-000443 16.25 KB Fri, 09 Jul 2021 11:04:21 GMT 3
1.1.1 16.1 KB Tue, 03 Mar 2020 17:16:32 GMT 3
1.1.1-alpha-000442 16.24 KB Fri, 09 Jul 2021 11:02:09 GMT 1
1.1.1-alpha-000402 16.15 KB Tue, 03 Mar 2020 17:10:13 GMT 1
1.1.1-alpha-000397 16.13 KB Wed, 19 Feb 2020 15:16:09 GMT 1
1.1.0 16.08 KB Mon, 10 Feb 2020 10:18:13 GMT 2
1.1.0-alpha-000388 16.13 KB Mon, 10 Feb 2020 10:10:09 GMT 1
1.0.3-alpha-000380 16.13 KB Tue, 28 Jan 2020 11:50:26 GMT 1
1.0.3-alpha-000379 16.13 KB Tue, 28 Jan 2020 11:44:25 GMT 2