This article will show you a general idea on how to Mount Azure Storage as a local share in a container app in App Service
and some key points when use it.
1. What is Bring your own storage(BYOS)?
BYOS means bring your own Azure Storage File share or Blob container into Azure Container Web App as network file share.
Currently it supports Azure Linux Web App and Windows Container Web App, but not support Azure Function Apps.
With BYOS, you do not need to rewrite code to use Storage SDK. Compared to Mount SMB Azure file share on Linux VM, it is much easier for using.
2. How to use it?
We can use it by simply clicking on Azure Portal:
Or use Azure CLI:
az webapp config storage-account add --resource-group <group-name> --name <app-name> --custom-id <custom-id> --storage-type <AzureFiles/AzureBlob> --share-name <share-name> --account-name <storage-account-name> --access-key "<access-key>" --mount-path <mount-path-directory>
Also, you can integrate it with ARM template:
3. Some key points:
After mounting, the web app will restart automatically, then we can check the mount info via ‘cat /etc/mtab’.
4. What is CIFS? And related issue.
Common Internet File System (CIFS) is a network filesystem protocol used for providing shared access to files and printers between machines on the network. A CIFS client application can read, write, edit and even remove files on the remote server. CIFS client can communicate with any server that is set up to receive a CIFS client request.
When use CIFS, local databases (eg SQLLite) or other components that rely on file handles/locks may get problem.
One workaround for the sqlite issue is changing the journal mode to wal by using below command:
sqlite3 <database-file> 'PRAGMA journal_mode=wal;'
There are advantages and disadvantages to using WAL instead of a rollback journal. Please read this reference carefully before using it: https://sqlite.org/wal.html
Thanks for reading this post. I hope you liked it. Please feel free to write your comments and views about the same over here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.