Quickstart: Create and manage Azure Files share with Windows virtual machines

The article demonstrates the basic steps for creating and using an Azure Files share. In this quickstart, the emphasis is on quickly setting up an Azure Files share so you can experience how the service works. If you need more detailed instructions for creating and using Azure file shares in your own environment, see Use an Azure file share with Windows.

If you don't have an Azure subscription, create a free account before you begin.

Sign in to Azure

Sign in to the Azure portal.

Prepare your environment

In this quickstart, you set up the following items:

  • An Azure storage account and an Azure file share
  • A Windows Server 2016 Datacenter VM

Create a storage account

Before you can work with an Azure file share, you have to create an Azure storage account. A general-purpose v2 storage account provides access to all of the Azure Storage services: blobs, files, queues, and tables. The quickstart creates a general-purpose v2 storage account but, the steps to create any type of storage account are similar. A storage account can contain an unlimited number of shares. A share can store an unlimited number of files, up to the capacity limits of the storage account.

To create a general-purpose v2 storage account in the Azure portal, follow these steps:

  1. In the Azure portal, select All services. In the list of resources, type Storage Accounts. As you begin typing, the list filters based on your input. Select Storage Accounts.

  2. On the Storage Accounts window that appears, choose Add.

  3. Select the subscription in which to create the storage account.

  4. Under the Resource group field, select Create new. Enter a name for your new resource group, as shown in the following image.

    Screenshot showing how to create a resource group in the portal

  5. Next, enter a name for your storage account. The name you choose must be unique across Azure. The name also must be between 3 and 24 characters in length, and can include numbers and lowercase letters only.

  6. Select a location for your storage account, or use the default location.

  7. Leave these fields set to their default values:

    Field Value
    Deployment model Resource Manager
    Performance Standard
    Account kind StorageV2 (general-purpose v2)
    Replication Read-access geo-redundant storage (RA-GRS)
    Access tier Hot
  8. Select Review + Create to review your storage account settings and create the account.

  9. Select Create.

For more information about types of storage accounts and other storage account settings, see Azure storage account overview. For more information on resource groups, see Azure Resource Manager overview.

Create an Azure file share

Next, you create a file share.

  1. When the Azure storage account deployment is complete, select Go to resource.

  2. Select Files from the storage account pane.

    Select Files

  3. Select + File Share.

    Select the add file share button

  4. Name the new file share qsfileshare > enter "1" for the Quota > select Create. The quota can be a maximum of 5 TiB, but you only need 1 GiB for this quickstart.

  5. Create a new txt file called qsTestFile on your local machine.

  6. Select the new file share, then on the file share location, select Upload.

    Upload a file

  7. Browse to the location where you created your .txt file > select qsTestFile.txt > select Upload.

So far, you've created an Azure storage account and a file share with one file in it in Azure. Next you'll create the Azure VM with Windows Server 2016 Datacenter to represent the on-premises server in this quickstart.

Deploy a VM

  1. Next, expand the menu on the left side of the portal and choose Create a resource in the upper left-hand corner of the Azure portal.

  2. In the search box above the list of Azure Marketplace resources, search for and select Windows Server 2016 Datacenter, then choose Create.

  3. In the Basics tab, under Project details, select the resource group you created for this quickstart.

    Enter basic information about your VM in the portal blade

  4. Under Instance details, name the VM qsVM.

  5. Leave the default settings for Region, Availability options, Image, and Size.

  6. Under Administrator account, add VMadmin as the Username and enter a Password for the VM.

  7. Under Inbound port rules, choose Allow selected ports and then select RDP (3389) and HTTP from the drop-down.

  8. Select Review + create.

  9. Select Create. Creating a new VM will take a few minutes to complete.

  10. Once your VM deployment is complete, select Go to resource.

At this point, you've created a new virtual machine and attached a data disk. Now you need to connect to the VM.

Connect to your VM

  1. Select Connect on the virtual machine properties page.

    Connect to an Azure VM from the portal

  2. In the Connect to virtual machine page, keep the default options to connect by IP address over port number 3389 and select Download RDP file.

  3. Open the downloaded RDP file and select Connect when prompted.

  4. In the Windows Security window, select More choices and then Use a different account. Type the username as localhost\username, where <username> is the VM admin username you created for the virtual machine. Enter the password you created for the virtual machine, and then select OK.

    More choices

  5. You may receive a certificate warning during the sign-in process. select Yes or Continue to create the connection.

Map the Azure file share to a Windows drive

  1. In the Azure portal, navigate to the qsfileshare fileshare and select Connect.

  2. Copy the contents of the second box and paste it in Notepad.

    The UNC path from the Azure Files Connect pane

  3. In the VM, open File Explorer and select This PC in the window. This selection will change the menus available on the ribbon. On the Computer menu, select Map network drive.

  4. Select the drive letter and enter the UNC path. If you've followed the naming suggestions in this quickstart, copy \qsstorageacct.file.core.windows.net\qsfileshare from Notepad.

    Make sure both checkboxes are checked.

    A screenshot of the "Map Network Drive" dialog

  5. Select Finish.

  6. In the Windows Security dialog box:

    • From Notepad, copy the storage account name prepended with AZURE\ and paste it in the Windows Security dialog box as the username. If you've followed the naming suggestions in this quickstart, copy AZURE\qsstorageacct.

    • From Notepad, copy the storage account key and paste it in the Windows Security dialog box as the password.

      The UNC path from the Azure Files Connect pane

Create a share snapshot

Now that you've mapped the drive, you can create a snapshot.

  1. In the portal, navigate to your file share and select Create snapshot.

    Create a snapshot

  2. In the VM, open the qstestfile.txt and type "this file has been modified" > Save and close the file.

  3. Create another snapshot.

Browse a share snapshot

  1. On your file share, select View snapshots.

  2. On the File share snapshots pane, select the first snapshot in the list.

    Selected snapshot in the list of time stamps

  3. On the pane for that snapshot, select qsTestFile.txt.

Restore from a snapshot

  1. From the file share snapshot blade, right-click the qsTestFile, and select the Restore button.

  2. Select Overwrite original file.

    Download and Restore buttons

  3. In the VM, open the file. The unmodified version has been restored.

Delete a share snapshot

  1. On your file share, select View snapshots.

  2. On the File share snapshots pane, select the last snapshot in the list and click Delete.

    Delete button

Use a share snapshot in Windows

Just like with on-premises VSS snapshots, you can view the snapshots from your mounted Azure file share by using the Previous Versions tab.

  1. In File Explorer, locate the mounted share.

    Mounted share in File Explorer

  2. Select qsTestFile.txt and > right-click and select Properties from the menu.

    Right-click menu for a selected directory

  3. Select Previous Versions to see the list of share snapshots for this directory.

  4. Select Open to open the snapshot.

    Previous Versions tab

Restore from a previous version

  1. Select Restore. This action copies the contents of the entire directory recursively to the original location at the time the share snapshot was created.

    Restore button in warning message

Clean up resources

When you're done, you can delete the resource group. Deleting the resource group deletes the storage account, the Azure file share, and any other resources that you deployed inside the resource group.

  1. In the left menu, select Resource groups.
  2. Right-click the resource group, and then select Delete resource group. A window opens and displays a warning about the resources that will be deleted with the resource group.
  3. Enter the name of the resource group, and then select Delete.

Next steps