Are you trying to store uploaded files in Azure using a Drupal CMS?
This guide is for you.
Drupal CMS is an Open source Content management system written in PHP and use MySQL.
Basically, you can enable and configure the blob storage module that uses Windows Azure blob storage for storing media files from your Drupal CMS.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform Azure related configuration tasks.
In this context, we shall look into how to store the uploaded files inside Azure in a Drupal CMS.
More information about Microsoft Azure and Drupal ?
Microsoft Azure is one of the cloud-computing services Microsoft provides for building, testing, deploying, and managing applications and services through Microsoft-managed data centers. When hosting a Drupal application in Azure, it is recommended to use one of their scalable Azure Storage services, such as Blobs, Azure Files, and so on rather than storing it in the same server.
In our Drupal Project, we created multiple instances of VPS nodes and databases to comply with Azure’s service level agreements (SLA). Since we cannot duplicate the user uploaded files in both hosts, we used Azure Storage, so that we can use the same set of files on different hosts and it would be updated.
How to store the uploaded files inside Azure in a Drupal CMS ?
One can also use Azure Files as an SMB mount storage for storing files. We set an SMB mount point on our VPS for storing the files. After verifying the permissions of the mount point ( read & write as apache user ), we then proceed with the integration task.
In order to integrate Azure Files with Drupal, we need to set the private file path to a location inside the File Share. Then change the upload buttons in the Webform Module to save the files to Private Storage.
For instance, if the Azure Files is mounted at /var/www/shared folder, we would set the private file path at /var/www/html/sites/default/settings.php as follows;
$settings['file_private_path'] = '/var/www/shared/private';
After that, we clear the drupal cache, either from admin panel or via drush.
The updated path is located under the Private file system path. Please note that here we have set the Default download method to 'Private local files server by Drupal'.
Additionally, we need to change the File upload destination to ‘Private files’ in all the form upload elements, such as the one shown below for a Drupal Webform based file input element.
Benefits of using Azure ?
i. Managed web server instances (Web Worker Role).
ii. Database services (SQL Azure).
iii. File storage and distribution (Azure Blob Storage).
iv. CDN and caching for both the web server instances and the file distribution.
v. Simple object storage (Azure Table).
vi. And other related services (less useful for Drupal).