Today’s article is about Azure files and how can we implement (Step by Step) the feature in our Azure farm.
What is it and why we need it?
The Azure Files service exposes file shares using the standard SMB 2.1 protocol. Applications running in Azure can now easily share files between VMs using standard and familiar file system APIs like ReadFile and WriteFile. In addition, the files can also be accessed at the same time via a REST interface, which opens a variety of hybrid scenarios. Finally, Azure Files is built on the same technology as the Blob, Table, and Queue Services, which means Azure Files is able to leverage the existing availability, durability, scalability, and geo redundancy that is built into our platform.
How can we implement it?
- 1st of all you will have to register to service as the Azure Files is a preview service – in order to register to service you should go to: http://go.microsoft.com/fwlink/?linkid=398495&clcid=0x409
- After you got a confirmation that you’re registered (not queued for registration but registered to the service) you should create a new storage.
- If you can’t see this it’s because you didn’t create a new storage or you didn’t successfully registered for the service.
- In case you see the Files URL you are now able to use the service.
1. You should download Azure PowerShell and then import your Azure Publish Settings File.
2. Then we should create the context for the storage account and key by using this PowerShell command:
# create a context for account and key
$ctx=New-AzureStorageContext account-name account-key
3. Then we should create a new file share by using this PowerShell command:
# create a new share
$s = New-AzureStorageShare sampleshare -Context $ctx
4. Now we shall create a directory (for example I wrote sampledir) inside the Share by using this PowerShell Command:
# create a directory in the share
New-AzureStorageDirectory -Share $s -Path sampledir
5. Now we shall Persist the storage account credentials for the virtual machine using this PowerShell command (from the VM):
cmdkey /add:<storage-account>.file.core.windows.net /user:<storage-account> /pass:<account-key>
6. Now we shall Mount the file share using the persisted credentials:
net use z: \\<storage–account>.file.core.windows.net\<share–name>
Senior Infrastructure Consultant @ AgileIT