Cloud Computing, Microsoft Azure, Powershell

Creating a file share in AZURE

Microsoft Azure offers fully managed file shares in the cloud. Because Azure File Storage exposes file shares using the Server Message Block 3.0 (SMB) protocol, the predominantly used file share protocol for existing on-premises applications, it simplifies moving your existing applications to the cloud, and because Azure File Storage allows applications to mount file shares from anywhere in the world, your on-premises applications can take advantage of cloud storage without change. Azure File Storage also implements REST API protocol, which enables you to develop modern applications that integrate with existing applications. And Microsoft Azure File Storage has got new features like; SMB 3.0 support, includes encryption and persistent handles, a new browser-based file explorer in the Azure portal,  Azure Storage Metrics for Azure File storage an also the ability to mount Azure File Storage file shares from outside of Azure datacenters.

So how to create a file share; (GUI or Powershell), let’s try Powershell…

Choose your storage account… We will need the name for our powershell cmdlets;

fileShare01

And then click on the storage account to go on CONFIGURE .

fileShare02

At the very bottom click on Manage Access Keys to get your key;

fileShare022

We are interested in the Primary Access Key, and click on the little file icon next to it to copy. This is the long key such as

b8VW6dmfugxsrNyF/TkHO9lkA00123456789KWEBJzPC0OBFStObAuUwzNJWUkT8Qs5AdUJsHGUiCYqbcjSw==

Next is we need to run our Powershell cmdlets;

$storageaccount = “msenelstorage01

$storageaccount_key = “b8VW6dmfugxsrNyF/TkHO9lkA0vSPs4jEos0w+KWEBJzPC0OBFStObAuUwzNJWUkT8Qs5AdUJsHGUiCYqbcjSw==

$sharename = “Logs”

$storageaccount_context = New-AzureStorageContext $storageaccount $storageaccount_key

$create_share = New-AzureStorageShare $sharename -Context $storageaccount_context

And let’s run this….

PS C:\Users\murat.senel> $storageaccount = “msenelstorage01”

$storageaccount_key = “b8VW6dmfugxsrNyF/TkHO9lkA0123456789jEos0w+KWEBJzPCFStObAuUwzNJWUkT8Qs5AdUJsHGUiCYqbcjSw==”

$sharename = “logs”

$storageaccount_context = New-AzureStorageContext $storageaccount $storageaccount_key

$create_share = New-AzureStorageShare $sharename -Context $storageaccount_context

PS C:\Users\murat.senel>

In the storage account, you can see the URL for file storage;

fileShare023

https://msenelstorage01.file.core.windows.net/

Now we can only check this on the Preview Portal as GUI;

Go to the Portal;

fileShare024

Click on the storage account that you used;

fileShare0245

Click on the Files >

fileShare02456

There it is, our Logs file share created….

The second method might be easier if you don’t want to use Powershell…

You can basically go to the File Share tab and  on the top you will see New Share tab.

fileShare02457

What else can we show with a file share ?

Lets’ create a directory (called Server001Logs) in the Logs share;

PS C:\Users\murat.senel> New-AzureStorageDirectory -Share $create_share -Path Server001Logs

Directory: https://msenelstorage01.file.core.windows.net/logs

Type                Length             Name                                                                                                                 —-                ——             —-                                                                                                                    DIR                                    Server001Logs

And upload a file in to that directory…

Set-AzureStorageFileContent -Share $create_share -Source C:\MyScripts\serverlist.txt -Path Server001Logs

Let’s check them on the Portal ….

fileShare0245788

Directory is there .. And our uploaded file is …… >

fileShare09

also there…. 😉

Advertisements