There are a number of storage options in the Microsoft Azure public cloud platform available to meet the various file storage requirements to support cloud-based applications and infrastructure. As I outlined in last month’s CloudComputingAdmin.com article, a popular storage option for structured data is Azure SQL databases. These can be Platform-as-a-Service (PaaS) SQL databases, pre-configured VMs with SQL installed, or a VM of your own that you’ve installed SQL server on. Azure Queue storage is also available to provide storage for messaging between processes hosted in Azure. In addition, Azure platforms and services also leverage Azure storage accounts, and you also have options to store data in blobs (large binary objects), tables (structured data), and queues (inter-process messages). Until recently there was no option available to store unstructured data, however. Thankfully Microsoft recently introduced Windows Azure Files, which is currently in preview. With Windows Azure Files you can create storage for unstructured data on a shared file system that is accessible using SMB as well as APIs. This will be tremendously beneficial especially for Azure-hosted virtual machine labs or production deployments. Having access to SMB storage will allow for the central storage of things like software, scripts, configuration files, etc.
Configuring Azure Files
As of this writing (September 2014) Azure files is currently in preview. You must first request access to the preview by visiting this link. Scroll down toward the bottom and click Try It next to Azure Files.
After you’ve enrolled in the Azure Files preview, create a new storage account by opening the Microsoft Azure management portal, selecting Storage in the navigation tree, and then clicking New at the bottom of the window and selecting Data Services, Storage, and Quick Create. Provide a name for the storage account (URL), specify a location and subscription, choose a replication model, and then click Create Storage Account.
Once the storage account has been created successfully, click Manage Access Keys at the bottom of the window. Copy the Storage Account Name and the Primary Access Key as they will be required to create and map to a file share in Azure.
Creating a file share is accomplished using PowerShell. Guidance for installing Azure PowerShell can be found here. To create a file share in Azure using PowerShell, open an elevated PowerShell window and execute the following commands:
$account = <storage account name>
$key = <storage account key>
$sharename = <share name>
$context = New-AzureStorageContext $account $key
$share = New-AzureStorageShare $sharename -Context $context
Accessing Azure Files Shares from Azure VMs
You can map to Azure Files shares from Azure VMs using the NET USE command and passing the credentials using the /U: switch as follows:
net use <drive letter>: \\<storage file name>.file.core.windows.net\<share name> /u:<storage account name> <storage account key>
However, mapping to Azure Files shares in this manner does not persist after a reboot. If access to the Azure Files share is required after reboots, it will be necessary to persist the credentials in Windows using the following command:
cmdkey /add:<storage account name>.file.core.windows.net /user:<storage account name> /pass:<storage account key>
You can then map a network drive to the Azure Files share that persist after reboots without specifying credentials using the following command:
net use <drive letter>: \\<storage account name>.file.core.windows.net\<share name>
You should now see the mapped network drive in Windows Explorer.
You can add files to the file share using a variety of methods, including AzCopy, which is a command-line tool for uploading and downloading data to and from Microsoft Azure blog and file storage. You can find more information about AzCopy here. You can also use the Storage Client Library to leverage REST API to copy files. The Storage Client Library can be found here. In addition you can leverage the tried and true method of mapping local drives in a Remote Desktop session (RDP) that has a network drive mapped to the Azure Files share.
Additional Notes on Azure Files Storage
Today, Azure Files storage is accessibly only via SMB 2.1. While there currently is no support for SMB 3.0, I would expect that to be included sometime in the future. As of this writing, Azure Files storage supports up to 5TB per share and individual files can be as large as 1TB. Azure Files storage provides support for up to 1000 IOPS per share and up to 60MBps per share, both when using large IOs. It is also possible to map drives to Azure Files SMB shares in Linux virtual machines with CIFS support installed. Files stored in Azure Files shares are accessible only from within the same region as the storage account when access via SMB, so plan accordingly. Files accessed via REST APIs are accessible from anywhere.
Azure Files storage provides a unique and much needed storage option for unstructured data in Microsoft Azure. It complements the existing storage options (SQL, blogs, tables, and queues) nicely and provides a convenient storage location for software, configuration files, utilities, and more that are commonly required when building out new virtual machines in Azure. With 5TB of data storage per file share available, administrators should find plenty of storage base for their commonly access files. You’re not limited to just Windows machines either. You can easily access SMB files shares in Azure Files storage from Linux workloads as well. And you can expect that future enhancements will be coming too, including SMB 3.0 support, and perhaps even Azure Active Directory authentication.