Uploading Blobs to Azure Storage with PowerShell

  • Updated


This article describes the PowerShell command to upload local Blob storage to Azure Blobs 

When uploading media in Episerver, the binary data are stored in a system called blob providers. By default, media are stored on disk in a folder located at <path_to-site>\App_Data\blobs. Moving all those Blobs to Azure is just one line of code in the Azure PowerShell console (just make sure the current directory is the blobs folder):

ls -File -Recurse | Set-AzureStorageBlobContent -Container mycontainer

If you have not used Azure PowerShell before you might want to read the getting started. To store Blobs in Azure (you don't need to run the site in Azure to do this), install the EPiServer.Azure package and change Blob provider in web.config:

    <blob defaultProvider="azureblobs">
        <add name="azureblobs" type="EPiServer.Azure.Blobs.AzureBlobProvider,EPiServer.Azure"
              connectionStringName="EPiServerAzureBlobs" container="mycontainer"/>

And then add the connection string:

    <add name="EPiServerAzureBlobs" connectionString="DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=abcdefghij" />

There is also a scheduled job on NuGet called EPiCode.BlobConverter that supports uploading to any Blob provider if a user interface is preferred.