Create a file share

You can create a share in Azure Files by using the Azure portal, the Azure Storage PowerShell cmdlets, the Azure Storage client libraries, or the Azure Storage REST API. In this article, you'll learn how to:

  • Create an Azure file share by using the Azure portal
  • Create an Azure file share by using PowerShell
  • Create an Azure file share by using the Azure CLI

Prerequisites

To create an Azure file share, you can use a storage account that already exists or create a new Azure storage account. To create an Azure file share with PowerShell, you'll need the account key and name of your storage account. You'll need a storage account key if you plan to use PowerShell or the CLI.

Note

If you want to create file shares larger than 5 TiB, see Enable large file shares.

Create a file share through the Azure portal

  1. Go to the Storage account pane on the Azure portal. Storage account pane

  2. Select the + File share button. The add File share button

  3. Enter your information for Name and Quota. The name and quota for the new file share

  4. View your new file share. The new file share in the UI

  5. Upload a file. The Upload button in the navigation bar

  6. Browse into your file share, and manage your directories and files. Folder view of file shares

Create a file share through PowerShell

Download and install the Azure PowerShell cmdlets. See How to install and configure Azure PowerShell for the install point and installation instructions.

Note

We recommend that you download and install, or upgrade to, the latest Azure PowerShell module.

  1. Create a new storage account. A storage account is a shared pool of storage where you can deploy Azure file shares and storage resources like blobs or queues.

    $resourceGroup = "myresourcegroup"
    $storAcctName = "myuniquestorageaccount"
    $region = "westus2"
    $storAcct = New-AzStorageAccount -ResourceGroupName $resourceGroup -Name $storAcctName -SkuName Standard_LRS -Location $region -Kind StorageV2
    
  2. Create a new file share.

    $shareName = "myshare"
    $share = New-AzStorageShare -Context $storAcct.Context -Name $shareName
    

Note

The name of your file share must be all lowercase. For complete details about naming file shares and files, see Naming and referencing shares, directories, files, and metadata.

Create a file share through the CLI

  1. Download and install the Azure CLI. See Install the Azure CLI and Get started with the Azure CLI.

  2. Create a connection string to the storage account where you want to create the share. Replace <storage-account> and <resource_group> with your storage account name and resource group in the following example:

     current_env_conn_string=$(az storage account show-connection-string -n <storage-account> -g <resource-group> --query 'connectionString' -o tsv)
    
     if [[ $current_env_conn_string == "" ]]; then  
         echo "Couldn't retrieve the connection string."
     fi
    
  3. Create the file share.

    az storage share create --name files --quota 2048 --connection-string $current_env_conn_string > /dev/null
    

Next steps

See these links for more information about Azure Files: