5

I created an App Service with Tomcat and a webapp that needs to store files, which should be accessible by another webapp in another App Service. The application only accepts absolute file paths.

If I put my webapps in a VM I could create a share to my azure file storage, but I guess this is not possible for a App Service (I get access denied when executing net use... in the console). I tried: \mystorage.file.core.windows.net\myfiles but it fails to write. Should this work? Is there a way I could a unc path to some azure location where both my App Services have access to? Or should I create vm's to achieve this?

David Makogon
  • 69,407
  • 21
  • 141
  • 189
Marcel Hoekstra
  • 1,334
  • 12
  • 19

1 Answers1

3

You can use a VM, as you suggested, for file-sharing, assuming your web app had appropriate access, on the same vnet, etc.

However, a VM, while capable of using durable storage, would have occasional outages (e.g. host OS update).

Azure has a specific feature precisely for this use case though: Azure File Storage, which sits atop blob storage and provides an SMB share. File Storage volumes are accessible by Web Apps, via API/SDK (you cannot mount an SMB volume to Web Apps).

Outside of Web Apps (e.g. VM's), Once a file share is mounted, you can use standard I/O operations, just like with a local disk

David Makogon
  • 69,407
  • 21
  • 141
  • 189
  • thanks for your answer. I tried configure this path: \\mystorage.file.core.windows.net\myfiles but i fails to write data. App is in same location and resource group as file storage. Do you have any idea what could be wrong? – Marcel Hoekstra Oct 12 '16 at 14:39
  • See David Ebbo's comment here: http://stackoverflow.com/a/33545941/483776 You cannot currently mount an SMB share with a Web App. – Jacob Foshee Apr 26 '17 at 03:49
  • 1
    @JacobFoshee - you're correct - and it was a momentary lapse in sanity when I originally posted this answer (as I've posted other answers exactly as you and David have stated). Editing now. – David Makogon Apr 26 '17 at 16:18
  • "You can use a VM", how would this work? App Services block SMB ports: https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox#restricted-outgoing-ports . Is there a non SMB way to do this? – Ojen Jul 09 '19 at 20:46
  • 1
    @Ojen - my answer specifically states that, to use Azure File service, you have to rely on the SDK, since you cannot have an SMB mount. As for accessing files via a VM, you would need to serve the file to the app service in some way (but, as you pointed out, not via SMB). And the File Service SDK is specific to Azure; it's not a generic SMB SDK. My answer was more focused toward file sharing with VMs (which I tried clarifying at the bottom of my answer). – David Makogon Jul 09 '19 at 21:05