How can I access a "local" path in an Azure Function?

Viewed 210

I have written an Azure function to create leads in the Zoho CRM. I gotten great guidance from members here and I have one last hurdle to get over. Zoho API writes to a location it calls the Resource Path. This has to be a local path. For example, running the function in VS, I can use a path to My Documents but not a system path to the temp folder or any other. I've tried several system paths which all throw an error. The actual error is a generic API error but Zoho support has told me its an access issue?

            string path = context.FunctionAppDirectory; 
            string path = System.IO.Path.GetTempPath(); 

The last conversation I had with support on this, they explained it as

However, upon having further discussions based on your questions with my development team, I was told that it is mandatory for the resource path to be a local path (Documents path in our case) an that it is not possible to retrieve a file stored on cloud and use it with the local SDK.

So I THINK my question is, can I create something that looks like a local path to use in my Azure Function. I was reading about mounting a Azure file share as a drive letter (https://docs.microsoft.com/en-us/azure/storage/files/storage-how-to-use-files-windows) but it seems to only work with Azure Windows servers rather than Azure Functions.

Any suggestions are appreciated.

2 Answers

Using temporary is usually the way to go for most but I'm unsure why that doesn't work with the Zoho API.

An option that you could try is to write data to %HOME% or $HOME on Windows or Linux plans, respectively. If you are on Linux, you could also consider mounting a file share.

I got on the Microsoft Q&A to ask and was told it wasn't possible in Azure Functions. As you indicate it would have to be on a some kind of server hosting with a drive letter mounted.

Related