Create a file share in Azure Files
You can create Azure File shares using the Azure portal, the Azure Storage PowerShell cmdlets, the Azure Storage client libraries, or the Azure Storage REST API. In this tutorial, you will learn:
- How to create an Azure file share using the Azure portal
- How to create an Azure file share using Powershell
- How to create an Azure file share using the CLI
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 a Storage account key if you plan to use Powershell or the CLI.
Create a file share through the Azure portal
Go to the Storage Account blade on the Azure portal:
Click on add File Share button:
Provide Name and Quota. The Quota's current maximum value is 5 TiB:
View your new file share:
Upload a file:
Browse into your file share and manage your directories and files:
Create file share through PowerShell
This article has been updated to use the new Azure PowerShell Az module. To learn more about the new Az module and AzureRM compatibility, see Introducing the new Azure PowerShell Az module. For installation instructions, see Install Azure 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.
It's recommended that you download and install or upgrade to the latest Azure PowerShell module.
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 Storage account access keys.
$storageContext = New-AzStorageContext <storage-account-name> <storage-account-key>
Create a new file share:
$share = New-AzStorageShare logs -Context $storageContext
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)
Create a connection string to the storage account where you want to create the share.
<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
Create the file share
az storage share create --name files --quota 2048 --connection-string $current_env_conn_string 1 > /dev/null
- Connect and Mount File Share - Windows
- Connect and Mount File Share - Linux
- Connect and Mount File Share - macOS
See these links for more information about Azure Files.
We'd love to hear your thoughts. Choose the type you'd like to provide:
Our feedback system is built on GitHub Issues. Read more on our blog.