Kentico CMS 7.0 Developer's Guide

Azure storage

Azure storage

Previous topic Next topic Mail us feedback on this topic!  

Azure storage

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

Configuring Kentico CMS to use Azure storage


1. Add the following key into the appSettings section of your web.config. The key indicates that CMS.IO should use the Azure storage provider to access files.


<add key="CMSExternalStorageName" value="azure" />


2. Specify the storage account name by inserting the following key into the web.config.


<add key="CMSAzureAccountName" value="AccountName" />


3. Specify the primary access key by adding the following key into the web.config.


<add key="CMSAzureSharedKey" value="PrimaryAccessKey" />


Optionally, you can adjust the following properties:




Sample Value


The folder specified by this key will be used to store temporary files on a local disk, e.g. when transferring large files to or from the storage account.

<add key="CMSAzureTempPath" value="C:\AzureTemp" />


Specifies a folder on a local disk where files requested from the storage account will be cached. This helps minimize the amount of blob storage operations, which saves time and resources.

<add key="CMSAzureCachePath" value="C:\AzureCache" />


Sets the endpoint used for the connection to the blob service of the specified storage account. If you wish to use the default endpoint, remove the setting completely from the appropriate files.

<add key="CMSAzureBlobEndPoint" value="" />


Indicates if the blob container used to store the application's file system should be public. If set to true, it will be possible to access files directly through the URL of the appropriate blob service, for example:



<add key="CMSAzurePublicContainer" value="true" />


URL of the HTTP endpoint of a Azure Blob storage CDN.

<add key="CMSAzureCDNEndpoint" value="" />


Storing files in different containers


By default, the system stores files in a single container. However, the built-in Azure storage provider allows you to specify sections of the file system, which will be stored in a different container.


1. Open the CMSHttpApplication.cs file from the App_Code\Application folder.


2. Add a using statement for CMS.IO.


3. In the Application_Start method, create a new instance of the Azure storage provider.


AbstractStorageProvider mediaProvider = new StorageProvider("Azure", "CMS.AzureStorage");


4. Specify the target container using the CustomRootPath property of the provider.


mediaProvider.CustomRootPath = "mymediacontainer";


Optionally, you can specify whether you want the container to be publicly accessible using the PublicExternalFolderObject property of the provider. True means the container is publicly accessible.


mediaProvider.PublicExternalFolderObject = true;


5. Use the following code to map a directory to the provider you've instantiated in step 3. This is the directory that you want to store in the container.


StorageHelper.MapStoragePath("~/MySite/Media/", mediaProvider);


6. Save the file.


7. If you're using web application, rebuild the solution.