Post date: Nov 27, 2015 9:29:51 AM
Step 1. Create a new Storage Account. The file endpoint for the account will be: <account name>.file.core.windows.net.
Step 2. Create the file share. Download the latest version of Azure PowerShell (version 0.8.5 and later) and install it following the instructions here. Once completed, start the PowerShell prompt and execute the following.
# create a context for account and key
$ctx=New-AzureStorageContext <account name> <account key>
# create a new share
$s = New-AzureStorageShare <share name> -Context $ctx
# create a directory in the test share just created
New-AzureStorageDirectory -Share $s -Path testdir
# upload a local file to the testdir directory just created
Set-AzureStorageFileContent -Share $s -Source D:\upload\testfile.txt -Path testdir
# list out the files and subdirectories in a directory
Get-AzureStorageFile -Share $s -Path testdir
# download files from azure storage file service
Get-AzureStorageFileContent -Share $s -Path testdir/testfile.txt -Destination D:\download
# remove files from azure storage file service
Remove-AzureStorageFile -Share $s -Path testdir/testfile.txt
Step 3: Persist your Storage Account creds for the VM.
Before mounting to the file share, first persist your storage account credentials on the virtual machine. This step allows Windows to automatically reconnect to the file share when the virtual machine reboots. To persist your account credentials, run the cmdkey command from the PowerShell window on the virtual machine. Replace <storage-account-name> with the name of your storage account, and <storage-account-key> with your storage account key.
cmdkey /add:<storage-account-name>.file.core.windows.net /user:<storage-account-name> /pass:<storage-account-key>
Step 4: Mount the storage on VM.
net use z: \\<account name>.file.core.windows.net\<share name> /u:<account name> <account key>