Create an Azure File Share

Learn how to create an Azure File share using the Azure portal, Azure CLI, or PowerShell.

Introduction

Azure Files offers fully managed cloud file shares that are accessible via the industry-standard Server Message Block (SMB) protocol. You can mount one or more of these shares to your cloud or on-premises applications. Azure Files is designed for cloud scenarios and can be used for:

Prerequisites

Before you begin, you need:

Steps to Create a File Share

Method 1: Using the Azure Portal

The Azure portal provides a user-friendly graphical interface for managing Azure resources.

  1. Sign in to the Azure portal.
  2. In the portal, navigate to your storage account. You can search for "Storage accounts" in the search bar at the top and select your storage account from the list.
  3. In the storage account menu, under Data storage, select File shares.
  4. Click the + File share button at the top of the File shares blade.
  5. A pane will appear. Enter a Name for your file share. Share names must be lowercase letters or numbers, and must start with a letter.
  6. Specify the Tier for your file share (e.g., Transaction optimized, Hot, Cool).
  7. Optionally, configure Quota (in GiB) for the share.
  8. Click Create to create the file share.

Tip

Azure Files shares are created within a storage account. Ensure you select the correct storage account where you want to create the share.

Method 2: Using Azure CLI

The Azure Command-Line Interface (CLI) is a powerful tool for managing Azure resources from the command line.

First, ensure you have the Azure CLI installed and are logged in:

az login

Then, use the following command to create a file share:

az storage share create --name <share-name> --account-name <storage-account-name> --account-key <storage-account-key> --quota <quota-in-gib> --tier <tier-name>

Replace the placeholders:

Example:

az storage share create --name myfileshare --account-name mystorageaccount --account-key "YOUR_STORAGE_ACCOUNT_KEY" --quota 1024 --tier TransactionOptimized

Note

For security reasons, it's recommended to use managed identities or service principals for authentication in production environments instead of account keys directly in scripts.

Method 3: Using Azure PowerShell

Azure PowerShell provides cmdlets for managing Azure resources.

First, ensure you have the Az PowerShell module installed and are connected to your Azure account:

Connect-AzAccount

Then, use the following cmdlet to create a file share:

New-AzRmStorageShare -ResourceGroupName <resource-group-name> -StorageAccountName <storage-account-name> -Name <share-name> -EnabledProtocol SMB -QuotaGiB <quota-in-gib> -AccessTier <tier-name>

Replace the placeholders:

Example:

New-AzRmStorageShare -ResourceGroupName "myResourceGroup" -StorageAccountName "mystorageaccount" -Name "mypsfileshare" -EnabledProtocol SMB -QuotaGiB 2048 -AccessTier Hot

Next Steps

Once your file share is created, you can:

Mount an Azure File Share Upload Files to an Azure File Share