I want to integrate and test Azure File Storage from my Web application, and before deploying it to the environment (where an Azure Shared folder is provisioned), I would like to test it on my local.
I have a docker container running Azurite on my local, and I am able to emulate an Azure Blob Storage Container on my local machine, connect with it and test.
I just want to be able to do the same for Azure File Storage. I don’t see support for the same in Azurite or the deprecated Azure Storage Emulator. As per the 5th point of official Microsoft docs – (https://learn.microsoft.com/en-us/azure/storage/common/storage-use-emulator#differences-between-the-storage-emulator-and-azure-storage), "The File service and SMB protocol service endpoints aren’t currently supported in the Storage Emulator.".
Is there a way to emulate File Storage on Azurite? Or any other supporting application, docker image, etc.?
2
Answers
One option is to mount the file share directly to a running docker container as a CIFS share. I tested this on the latest Ubuntu docker image pulled from docker hub. To authenticate to the file share, you’ll need the storage account’s name and access key which can be found in the portal view for your particular storage account.
Pull the latest image and run it specifying
--privileged
flag to avoidmount: <mount-path>: permission denied
errorsInstall
cifs-utils
package in case its missingIn my example, the file share is named
root
so I mount it at/mnt/root
in the container.Similar instructions to mount the share can also be found through the portal:
Your-Storage-Account
>File shares
>Your-share
>Connect
.There is currently no emulator for File shares, but one of the workarounds is that you may use PowerShell by creating a storage account in Azure and leverage the file share as a local drive on your local machine.
For more information on this, you can follow Use an Azure file share with Windows