How to setup your Umbraco media folder with an Azure storage account

In this blog post, we will go through how you can setup your Umbraco media files to use an Azure storage account. This process involves installing the NuGet package UmbracoFileSystemProviders.Azure.

Pre-requisites: Before proceeding below, make sure you already have an Azure Blob storage account with at least one container (i.e. media) and that you have access keys for this.

  1. Open Microsoft Azure Storage Explorer (download here if you don’t have it yet)
  2. On the prompt “Connect to Azure storage”, select “Use a storage account name and key”
  3. Connect to azure storage
  4. Enter the storage account name and one of the access keys
  5. Enter azure storage account details
  6. Once connected, navigate to your storage account, and expand “Blob containers”. You should see all your containers like the below:
  7. Microsoft Azure Storage explorer
  8. Click on the container
  9. Navigate to where your Media files are in the file system. This is usually located on your Umbraco project root path > Media
  10. Umbraco media files
  11. Select all folders including the web.config, drag and drop to the Azure Storage explorer to upload
  12. Your storage account container should now reflect all files you have on the file system
  13. Uploaded media files
  14. On your Visual Studio, open package manager console (Tools > NuGet package manager)
  15. Run the command Install-Package UmbracoFileSystemProviders.Azure
  16. Open config > FileSystemProviders.config and update the following
    <add key="containerName" value="media"/>
    <add key="rootUrl" value="http://[YourStorageAccountName].blob.core.windows.net/"/>
    <add key="connectionString" value="DefaultEndpointsProtocol=https;AccountName=[YourStorageAccountName];AccountKey=[YourAccountKey]"/>

Your media files should now be connected to the Azure Storage account. Once you’ve verified your site still loads the images, you can then go ahead and delete your media files in the file system, 🙂

 

%d bloggers like this: