Muokkaa

Jaa


Quickstart: Create and use an SMB Azure file share

Azure Files is Microsoft's easy-to-use cloud file system. You can mount SMB Azure file shares in Windows, Linux, and macOS operating systems. This article shows you how to create an Azure file share using either the Azure portal, Azure CLI, or Azure PowerShell.

Applies to

This Quickstart only applies to SMB Azure file shares. Standard and premium SMB file shares support locally redundant storage (LRS) and zone-redundant storage (ZRS). Standard file shares also support geo-redundant storage (GRS) and geo-zone-redundant storage (GZRS) options. For more information, see Azure Files redundancy.

File share type SMB NFS
Standard file shares (GPv2), LRS/ZRS Yes No
Standard file shares (GPv2), GRS/GZRS Yes No
Premium file shares (FileStorage), LRS/ZRS Yes No

Getting started

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

Create a storage account

A storage account is a shared pool of storage in which you can deploy an Azure file share or other storage resources, such as blobs or queues. 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 storage account using the Azure portal:

  1. Under Azure services, select Storage accounts.

  2. Select + Create to create a storage account.

  3. Under Project details, select the Azure subscription in which to create the storage account. If you have only one subscription, it should be the default.

  4. If you want to create a new resource group, select Create new and enter a name such as myexamplegroup.

  5. Under Instance details, provide a name for the storage account. You might need to add a few random numbers to make it a globally unique name. A storage account name must be all lowercase and numbers, and must be between 3 and 24 characters. Make a note of your storage account name. You'll use it later.

  6. In Region, select the region you want to create your storage account in.

  7. In Primary service, select Azure Files.

  8. In Performance, keep the default value of Standard.

  9. In Redundancy, select Locally redundant storage (LRS).

    Screenshot showing how to enter the project and instance details for a storage account using the Azure portal.

  10. Select Review + create to review your settings. Azure will run a final validation.

  11. When validation is complete, select Create. You should see a notification that deployment is in progress.

  12. When you see a notification that your deployment is complete, select Go to resource.

Create an Azure file share

To create an Azure file share:

  1. Select the storage account from your dashboard.

  2. In the service menu, under Data storage, select File shares.

    Screenshot showing the data storage section of the storage account; select file shares.

  3. On the menu at the top of the File shares page, select + File share. The New file share page drops down.

  4. In Name, type myshare. File share names must be all lower-case letters, numbers, and single hyphens, and must begin and end with a lower-case letter or number. The name can't contain two consecutive hyphens. For details about naming file shares and files, see Naming and Referencing Shares, Directories, Files, and Metadata.

  5. Leave Transaction optimized selected for Access tier.

  6. Select the Backup tab. By default, backup is enabled when you create an Azure file share using the Azure portal. If you want to disable backup for the file share, uncheck the Enable backup checkbox. If you want backup enabled, you can either leave the defaults or create a new Recovery Services Vault in the same region and subscription as the storage account. To create a new backup policy, select Create a new policy.

    Screenshot showing how to enable or disable file share backup.

  7. Select Review + create and then Create to create the Azure file share.

Create a directory

To create a new directory named myDirectory at the root of your Azure file share:

  1. On the File share settings page, select the myshare file share. The page for your file share opens, indicating no files found.
  2. On the menu at the top of the page, select + Add directory. The New directory page drops down.
  3. Type myDirectory and then select OK.

Upload a file

First, you need to create or select a file to upload. Do this by whatever means you see fit. When you've decided on the file you'd like to upload, follow these steps:

  1. Select the myDirectory directory. The myDirectory panel opens.

  2. In the menu at the top, select Upload. The Upload files panel opens.

    Screenshot showing the upload files panel in the Azure portal.

  3. Select the folder icon to open a window to browse your local files.

  4. Select a file and then select Open.

  5. In the Upload files page, verify the file name, and then select Upload.

  6. When finished, the file should appear in the list on the myDirectory page.

Download a file

You can download a copy of the file you uploaded by right-clicking on the file and selecting Download. The exact experience will depend on the operating system and browser you're using.

Clean up resources

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

If there are locks on the storage account, you'll need to remove them first. Navigate to the storage account and select Settings > Locks. If any locks are listed, delete them.

You might also need to delete the Azure Backup Recovery Services vault before you're allowed to delete the resource group.

  1. Select Home and then Resource groups.
  2. Select the resource group you want to delete.
  3. Select Delete resource group. A window opens and displays a warning about the resources that will be deleted with the resource group.
  4. Enter the name of the resource group, and then select Delete.

Next step