What is Azure File Storage?
Azure File Storage Service provides an SMB protocol interface to Azure Blob Storage which allows users to mount the storage as a native share on any Azure Virtual Machine.
File storage offers shared storage for applications using the standard SMB 2.1 protocol. Microsoft Azure virtual machines and cloud services can share file data across application components via mounted shares, and on-premises applications can access file data in a share via the File storage API.
Applications running in Azure virtual machines or Azure cloud services can mount a File storage share to access file data, just as a desktop application would mount a typical SMB share. Any number of Azure virtual machines or roles can mount and access the File Storage share simultaneously.
Common scenarios for the use of Microsoft Azure File Storage:
|1. “Lift and Shift” applications|
|Azure Files makes it easier to “lift and shift” applications to the cloud that use on-premise file shares to share data between parts of the application. To make this happen, each VM connects to the file share and then it can read and write files just like it would against an on-premise file share.|
|2. Shared Application Settings|
|A common pattern for distributed applications is to have configuration files in a centralized location where they can be accessed from many different virtual machines. Such configuration files can now be stored in an Azure File share, and read by all application instances. These settings can also be managed via the REST interface, which allows worldwide access to the configuration files.|
|3. Diagnostic Share|
|An Azure File share can also be used to save diagnostic files like logs, metrics, and crash dumps. Having these available through both the SMB and REST interface allows applications to build or leverage a variety of analysis tools for processing and analyzing the diagnostic data.|
|When developers or administrators are working on virtual machines in the cloud, they often need a set of tools or utilities. Installing and distributing these utilities on each virtual machine where they are needed can be a time consuming exercise. With Azure Files, a developer or administrator can store their favorite tools on a file share, which can be easily connected to from any virtual machine.|
The current specifications of Azure File Storage are in Preview mode and might differ from the final version.
Scalability targets for Azure Files:
The following are the preview scalability targets for Azure Files:
- Up to 5TB per share
- A file can be up to 1 TB
- Up to 1000 IOPS (of size 8KB) per share
- Up to 60MBps per share of data transfer for large IOs
There is currently no time line for future features, but SMB 3.0 and an increase of share size are some of the main priorities.
Creating an Azure File Share
Create an Azure Storage account in 8 Easy Steps:
- Login to your Azure account and click NEW.
- Click DATA SERVICES, then STORAGE, and then click QUICK CREATE.
- In URL, type a subdomain name to use in the URI for the storage account. The entry can contain from 3-24 lowercase letters and numbers. This value becomes the host name within the URI that is used to address Blob, Queue, or Table resources for the subscription.
- Choose a Region/Affinity Group in which to locate the storage. If you will be using storage from your Azure application, select the same region where you will deploy your application.
- Optionally, you can select the type of replication you desire for your account. Geo-redundant replication is the default and provides maximum durability.
- Click CREATE STORAGE ACCOUNT.
- Browse into the new storage account and in the Dashboard you will find the URL path to the File Storage service. Ex: https://storage1.file.core.windows.net/
- Click on MANAGE ACCESS KEY to generate and document the key to be used for authentication.
Use Azure PowerShell to create a file share
Now we have the File Storage URL path and Key. Let’s open the Azure Powershell module from a local computer and run these commands:
# Login to the Azure subscription with the Azure Storage Account $cred = Get-Credential Add-AzureAccount –Credential $cred
# create a context for account and key – Where "account-name" is the name of the storage account and "account-key" is the encrypted key we documented previously.
$ctx=New-AzureStorageContext account-name account-key Example: $ctx=New-AzureStorageContext storage1 Yjdia8nzwV6w2R0+ic/lpbNKw/t2gaYxcwEq/ /DxcuHgDrrW+u6aRE311nLG6eOtIwNHejg6UsWv+oVJW5hA==
# create a new share – Where "sampleshare" is a name for the new share. $s = New-AzureStorageShare sampleshare -Context $ctx Example: $s = New-AzureStorageShare PublicFiles -Context $ctx
# create a directory in the share – Where "sampledir" is a folder within the new share. New-AzureStorageDirectory -Share $s -Path sampledir Example: New-AzureStorageDirectory -Share $s -Path Applications
Mount the share from an Azure virtual machine
Now that we have a file share and a folder created in the File Storage Service we are ready to mount the share for usage. From the computer to use the share lets open a command line interface and follow these steps.
We first authenticate the share access:
cmdkey /add:storage1.file.core.windows.net /user:storage1 /pass:Yjdia8nzwV6w2R0+ic/lpbNKw/t2gaYxcwEq//DxcuHgDrrW+u6aRE311nLG6eOtIw
From here we can proceed to map a network drive from the command line or GUI as preferred:
net use z: \\storage1.file.core.windows.net\PublicFiles
Lastly, we can access the new share directly if we are planning to add more shares than available drive letters:
Example: Open the Windows Explorer and in the address bar browse to \\storage1.file.core.windows.net\PublicFiles
Remember that if you have 10 servers that need access to the share, these two commands need to be executed on all 10 servers for simultaneous access.