Create a file share in Azure Files

You can create Azure File shares using Azure portal, the Azure Storage PowerShell cmdlets, the Azure Storage client libraries, or the Azure Storage REST API. In this tutorial, you will learn:

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 will need the account key and name of your storage account. You will need Storage account key if you plan to use Powershell or CLI.

Create file share through the Azure portal

  1. Go to Storage Account blade on Azure portal:
    Storage Account blade

  2. Click on add File Share button:
    Click the add file share button

  3. Provide Name and Quota. Quota currently can be maximum 5 TiB:
    Provide a name and a desired quota for the new file share

  4. View your new file share: View your new file share

  5. Upload a file: Upload a file

  6. Browse into your file share and manage your directories and files: Browse file share

Create file share through PowerShell

To prepare to use PowerShell, download and install the Azure PowerShell cmdlets. See How to install and configure Azure PowerShell for the install point and installation instructions.

Note

It's recommended that you download and install or upgrade to the latest Azure PowerShell module.

  1. Create a context for your storage account and key The context encapsulates the storage account name and account key. For instructions on copying your account key from the Azure portal, see View and copy storage access keys.

    $storageContext = New-AzureStorageContext <storage-account-name> <storage-account-key>
    
  2. Create a new file share:

    $share = New-AzureStorageShare logs -Context $storageContext
    
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 file share through Command Line Interface (CLI)

  1. To prepare to use a Command Line Interface (CLI), download and install the Azure CLI.
    See Install Azure CLI 2.0 and Get started with Azure CLI 2.0.

  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 file share

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

Next steps

See these links for more information about Azure Files.