Share via


Creating files in Microsoft Azure storage

Introduction

Today I will show you how to create a file in Microsoft Azure Storage. In it we will share files between servers in Azure and between applications can access data from file on a share through the API.

This feature is in Preview is not yet released, to enable in your subscription simply go on Microsoft Azure Preview and browse the "Azure Files" and enable on your account.

Remember that the Preview of the file Storage is only available to a new array.

Creating Storage

For the creation of Storage we in New > Data Service > Storage >Creation Quickly then we'll add the following information:

  1. URL = A name for your Storage.
  2. Local/affinity group = You choose the region where you want to stay your allocated Storage. The same locale that your Storage is your Virtual machine has to be.
  3.  Data Replication Options of your storage account is replicated to ensure durability which is also highly available, given the service level agreement Azure storage even in the case of transitional failures of hardware. The Azure storage is deployed in 15 regions around the world and also includes support for replicating data between different regions. You have several options to replicate the data in your storage account:
  • Locally Redundant Storage: Locally redundant storage (LRS) replicates your data within the region in which you created your account. To maximize durability, each request made in relation to your storage account is replicated three times. These three replicates each reside on separate failures and update domains domains. A failed domain (FD) is a group of nodes that represent a physical unit of failure and can be thought of as nodes that belong to the same physical media. A domain (UD) is a group of us that are updated together during the process of updating service (rollout). The three replicas are spread by UDs and DFs to ensure that data is available, even if the hardware failure impacts a single rack and when we are updated during a launch. An application returns successfully only after it has been written for all three replicas.
  • Redundant Storage Zone: redundant storage zone (ZRS) replicates your data through 2 to 3 datacenters in the same region or in two different regions, providing greater durability than LRS. If your storage account allowed ZRS, so your data is durable, even in the event of a failure in one of the facilities.
  • Geo-redundante Storage: storage geo-redundante (GRS) replicates its data to a secondary region is hundreds of miles away from the primary region. If your storage account allowed GRS, so your data is durable, even in the event of a fall, or a regional disaster in which the primary region is not recoverable. For a storage account with GRS activated, an update is committed first and foremost to the primary region, where it is replicated three times. Then, the update is replicated to the secondary region, where it is also replicated three times, between domains separate failure and update fields.
  • Redundancy Geographically with Read Access: geo-redundant storage (RA-GRS) maximizes the availability of your storage account, providing read-only access to the data at the secondary site, in addition to replication in two regions provided by GRS. In the case of data becomes unavailable in the primary region, your application can read data from the secondary region. When you enable read-only access to your data in the region, its data are available on a secondary endpoint, in addition to the primary purpose for your storage account. The secondary objective is similar to the primary endpoint, but adds the suffix-secondary to the account name. For example, if your primary purpose for the Blob service is myaccount.blob.core.windows.net, then your secondary objective is myaccount-secondary.blob.core.windows.net. The access keys for your storage account are the same for both the primary and secondary endpoints.

Reference: Microsoft Azure Storage redundancy.

https://3.bp.blogspot.com/-3O-07MGs_vU/VWyVL1okXUI/AAAAAAAAPiI/CdrOJnmvkm0/s640/1.jpg

After filling in the data then click Create storage account.

Let's check on Storage if he created the Files

https://2.bp.blogspot.com/-Brwepc-kj7U/VWyad5SEl1I/AAAAAAAAPig/E2-RBqOmKA0/s640/3.jpg

Creating Shared File

Now we need the name of the Storage and access of the Storage key, for this we go to the Panel > Manage access keys

https://4.bp.blogspot.com/-vVwjhfmT-Xg/VWybyg47yjI/AAAAAAAAPis/Ar_8_oLkAaM/s640/4.jpg

Under Manage Access Keys take Storage name and Primary Key

https://1.bp.blogspot.com/-L3nzQyaqad8/VWydAWAVnnI/AAAAAAAAPi4/08DtIqmsNmA/s1600/5.jpg

To make the installation of the Module Powershell to Microsoft Azure access this link to install Powershell Microsoft Azure.

With Powershell installed log into your account, run the following command

add-azureaccount

https://1.bp.blogspot.com/-0gX7ajCu6Jw/VWyZLjYAlOI/AAAAAAAAPiU/C2jbwiCfLAo/s640/2.jpg

We will create the context for the account and key, run the following command

$MJ=New-AzureStorageContext demoazurefiles 9yF0cIFAtcdgTuuAmZYbIvE24QgsrKh9nd8e9K8NePDxS2eQ8TUncmEkykiesSjLinUG60cq/RZIA3Pkgk8d3w==

https://3.bp.blogspot.com/-cSqi2Aoh4EA/VW9cJoj1VII/AAAAAAAAPkU/0WnmB43leUw/s640/3.jpg

Now we will create the file, run the following command

$s = New-AzureStorageShare demoazurefiles -Context $MJ

https://3.bp.blogspot.com/-4Fn3hr8TnSk/VW9dCgtOYCI/AAAAAAAAPkc/CUe4gQ3bldw/s640/4.jpg

After creating the file, we will create a directory and a file, run the following command

New-AzureStorageDirectory -Share $s -Path demoazurefiles

https://1.bp.blogspot.com/-E_LDk1jX4k8/VW9deajmGgI/AAAAAAAAPkk/VIR_rH9UxBA/s640/6.jpg

Now let's do a upload a file to test the sharing, run the following command

Set-AzureStorageFileContent -Share $s -Source C:\TesteAzureFiles\Azure.txt -Path demoazurefiles

https://2.bp.blogspot.com/-QToSVo1QWF0/VW9eZA3C7BI/AAAAAAAAPkw/szSecozWWUk/s640/7.jpg

After uploading the file we will list the folder with the following command

Get-AzureStorageFile -Share $s -Path demoazurefiles

https://3.bp.blogspot.com/--_rKJHk1208/VW9fB8EIbsI/AAAAAAAAPk4/ham2PbQ_Zz0/s640/8.jpg

Ready the File Storage is configured.

Mounting share for virtual machines in Microsoft Azure

Now let's set up the file shares on the virtual machines, remember that only works on Azure environment because the tool is still in Preview.

To mount the share we'll add the storage account and the key

cmdkey /add:demoazurefiles.file.core.windows.net /user:demoazurefiles /pass:9yF0cIFAtcdgTuuAmZYbIvE24QgsrKh9nd8e9K8NePDxS2eQ8TUncmEkykiesSjLinUG60cq/RZIA3Pkgk8d3w==

https://2.bp.blogspot.com/-AXb1Dqum2R8/VW9nEXG1hcI/AAAAAAAAPl0/B8Hi905jVbk/s640/9.jpg

Then we will use the "Net Use" to share the Storage in the Virtual machine, run the following command

net use m: \demoazurefiles.file.core.windows.net\demoazurefiles

https://1.bp.blogspot.com/-OkbQQttZhCk/VW9km2fX7wI/AAAAAAAAPlQ/7zwWT8RIykA/s640/10.jpg

Okay let's see how was the mapping of Storage on the Machine

https://1.bp.blogspot.com/-BVLmtNFcyS8/VW9lw7cNVBI/AAAAAAAAPlk/KhvTq1TdQxQ/s640/11.jpg

https://2.bp.blogspot.com/-iKi_FyXjTkA/VW9lwrc5OmI/AAAAAAAAPlg/YTVo1qZOQP4/s640/12.jpg

https://2.bp.blogspot.com/-Sb-4LfzqcLU/VW9lwnBvWyI/AAAAAAAAPlc/tkxN6csZfUo/s640/13.jpg

Ready your Storage Files is sharing between machines on Microsoft Azure.

Credits:
This document was originally published as http://www.micheljatoba.com.br/2015/06/criando-file-storage-no-microsoft-azure.html and has been reproduced here to allow the community to correct any inaccuracies or provide other improvements until you update the original version of this topic.