Sign in during Public Preview to get the Team plan free, plus an early-adopter discount when we launch. Sign in
This guide shows you how to use Azure Files against Locally. We'll create a file share in a Storage Account, then create a directory and upload, list, download and delete a file through its data plane with the Azure CLI.
az) installed.Firstly, we need to launch Locally which we can do from a terminal by running:
$
locally build
Once Locally has started, the Locally Dashboard will open automatically:
Next we can create the Resource Group to hold the Storage Account:
$
locally run az group create -n sample-file-shares -l berlin
There's two things to note here:
locally run.locally run when you do.File shares live in a Storage Account, so let's create one:
$
locally run az storage account create --name samplefileshares1 --resource-group sample-file-shares --location berlin --sku Standard_LRS --query "{name:name, provisioningState:provisioningState, fileEndpoint:primaryEndpoints.file}"
{
"fileEndpoint": "https://samplefileshares1.file.core.storage.locally:5660/",
"name": "samplefileshares1",
"provisioningState": "Succeeded"
}
That file endpoint is served by the Storage Emulator running on your machine.
Now we can create a share called reports, with a 10 GiB quota:
$
locally run az storage share-rm create --resource-group sample-file-shares --storage-account samplefileshares1 --name reports --quota 10 --query "{name:name, quota:shareQuota, type:type}"
{
"name": "reports",
"quota": 10,
"type": "Microsoft.Storage/storageAccounts/fileServices/shares"
}
Note
locally storage share create --account samplefileshares1 --name reports creates a share too, and locally storage share list lists them. Those are part of Locally itself, so they don't take the locally run prefix.The az storage directory and az storage file commands need the account's connection string. Putting it in AZURE_STORAGE_CONNECTION_STRING means we don't have to pass it to each one:
$
export AZURE_STORAGE_CONNECTION_STRING=$(locally storage connection-string --account samplefileshares1)
Let's create a directory in the share:
$
locally run az storage directory create --share-name reports --name 2026
{
"created": true
}
Then create a small file and upload it into that directory:
$
echo 'october sales: 42 units' > october.txt
$
locally run az storage file upload --share-name reports --source october.txt --path 2026/october.txt -o none
We can confirm it's there:
$
locally run az storage file list --share-name reports --path 2026 --query "[].{Name:name, Size:properties.contentLength}" -o table
Name Size
----------- ------
october.txt 24
Let's read it back out again:
$
locally run az storage file download --share-name reports --path 2026/october.txt --dest ./downloaded.txt -o none
$
cat downloaded.txt
october sales: 42 units
Then delete the file, and the now-empty directory:
$
locally run az storage file delete --share-name reports --path 2026/october.txt -o none
$
locally run az storage directory delete --share-name reports --name 2026 -o none
Finally, we can tidy up. To remove just the share, and any files still in it:
$
locally run az storage share-rm delete --resource-group sample-file-shares --storage-account samplefileshares1 --name reports --yes
Or to remove the Resource Group and everything within it:
$
locally run az group delete -n sample-file-shares --yes
Whilst this guide used the Azure CLI, the Storage Account and its file shares work the same way through any of the tooling that Locally supports - Microsoft.Storage/storageAccounts and Microsoft.Storage/storageAccounts/fileServices/shares resources in HashiCorp Terraform or OpenTofu, Pulumi, Bicep or an ARM Template all provision against Locally in the same way.
The same is true of the data plane: hand the connection string to the Azure SDK for .NET, Go or Python and your application reads and writes files against Locally.
To write and read blobs in the same kind of account, see Storage Account. For messages rather than files, see Storage Queues.
Should you encounter any issues, please take a look at the troubleshooting section.
These are the Azure resource types this guide creates in Locally:
Sign in during Public Preview to get the Team plan free, plus an early-adopter discount when we launch. Sign in
Your Azure infrastructure, running on your machine. Deploy in seconds, break things freely, and ship to Azure when you're ready.