Step-By-Step: Creating a File Share in Azure
File storage in Azure offers shared storage for applications and virtual machines in Azure. The access to the share uses SMB 2.1 protocol. Basically, apps and VM can access date using a mounted file share, and on-premise applications can access file data in a share via the File storage API. The common uses of File storage in Azure include:
• Migrating on-premise applications that rely on file shares to run on Azure virtual machines or cloud services, without expensive rewrites
• Storing shared application settings, for example in configuration files
• Storing diagnostic data such as logs, metrics, and crash dumps in a shared location
• Storing tools and utilities needed for developing or administering Azure virtual machines or cloud services
Create new Storage Account
1. After login into the Azure Management Portal, at the bottom of the navigation pane, click NEW. Then Click DATA SERVICES, then STORAGE, and then click QUICK CREATE.
Fill in the info for your new storage account, and when you’re done click Create Storage Account
Create File Share
2. To create the file share you need to use PowerShell, so you need to ensure that you have installed the PowerShell cmdlets for Azure Storage. The PowerShell cmdlets for the File service are available only in the latest Azure PowerShell module, version 0.8.5 and later. It’s recommended that you download and install or upgrade to the latest Azure PowerShell module.
Once the PowerShell module has been updated, use the following commands to create the file share.
• # create a context for account and key
$FSContext=New-AzureStorageContext prfspost <storage Access Key>
• # create a new share
$FS = New-AzureStorageShare sampleshare -Context $FSContext
When you create the context you get the account name and keys from the “manage key Access” in the action bar at the bottom.
After running the last commands to create the file share, create a directory and a file
• # create a directory in the share
• New-AzureStorageDirectory -Share $FS -Path sampledir
Mount the share from an Azure virtual machine
Before mounting to the file share, set the storage account credentials on the virtual machine. This allows Windows to automatically reconnect to the file share when the virtual machine reboots. To persist your account credentials, execute the cmdkey command from within the PowerShell window on the virtual machine.
• cmdkey /add:prfspost.file.core.windows.net /user:prfspost /pass:<storage Access Key>
Once this is done, use a standard “Net Use” command to connect to the share. Use the storage account name and the share name created earlier.
• net use z: \\prfspost.file.core.windows.net\sampleshare
You can now browse the share from the VM.
Disclaimer: Many of the articles are taken from MSDN, Azure tutorials and other sources on internet to provide a single place for various information about azure development.No copyright on this information is claimed and the copyright of all information is acrrued to all original authors including MSDN and Microsoft azure training materials.Some of this information shall be outdated or incorrect and the authenticty of the information contained should be verified with changes in azure or your own environment. We do not recommend using any of this information without proper consultation.