I have a Azure Function which reads a file from OnPremise server using Hybrid Connection.
using (var csvStreamReader = new StreamReader("\\servername\sample.csv"))
...
On run the function app converts the above filepath to "C://azurefuncpath/servername/sample.csv" and errors out. What should be the right way to provide the file path so the function app to use server path instead of local path.
Update 1 I tried a below code to see if Azure Function is able to access the folder using Hybrid Connection
var files = Directory.GetFiles(@"\\ServerName\FolderName", "*.*", SearchOption.AllDirectories);
foreach (var file in files)
{
log.LogInformation(file);
}
return new OkResult();
I see in onpremise server the Hybrid connection shows it's in Connected state. Should i be using some other way to do this operation?