Using Azure File Shares

Preview

Sign in during Public Preview to get the Team plan free, plus an early-adopter discount when we launch. Sign in

Using Azure File Shares

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.

Before you start

Plugin required

Locally v2026.10+ automatically installs this Resource Provider plugin when its Resource Provider is registered, but you can also install it via:

$ locally plugin install --name Microsoft.Storage

1. Start Locally

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:

Screenshot of the Locally Dashboard

2. Create a Resource Group

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:

  1. The Azure CLI supports Automatic Configuration, meaning that it can automatically be configured to work against Locally just by prefixing commands with locally run.
  2. Locally intentionally uses a different set of locations to Azure as a safety precaution, so that you can be confident you're deploying against Locally rather than regular Azure. You can also configure Locally to use the Azure locations too, but you'll want to be extra sure that you're prefixing commands with locally run when you do.

3. Create the Storage Account

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.

4. Create a file share

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.

5. Upload a file

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

6. Download and delete the file

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

7. Tidy up

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

Doing this with other tooling

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.

Next steps

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.

Resource types this guide uses

These are the Azure resource types this guide creates in Locally:

  • Microsoft.Storage/storageAccounts/fileServices/shares
  • Microsoft.Storage/storageAccounts
Preview

Sign in during Public Preview to get the Team plan free, plus an early-adopter discount when we launch. Sign in

A local cloud for you and your AI agents.

Your Azure infrastructure, running on your machine. Deploy in seconds, break things freely, and ship to Azure when you're ready.