Hello @Nuwan Wickramanayaka
If you want to use REST API you should make a request directly to Azure File Share, as in your case file share is mounted via SMB protocol
Code example
string connectionString = "<connection_string>";
// Name of the share, directory, and file we'll download from
string shareName = "sample-share";
string dirName = "sample-dir";
string fileName = "sample-file";
// Path to the save the downloaded file
string localFilePath = @"<path_to_local_file>";
// Get a reference to the file
ShareClient share = new ShareClient(connectionString, shareName);
ShareDirectoryClient directory = share.GetDirectoryClient(dirName);
ShareFileClient file = directory.GetFileClient(fileName);
// Download the file
ShareFileDownloadInfo download = file.Download();
using (FileStream stream = File.OpenWrite(localFilePath))
{
download.Content.CopyTo(stream);
}
If you want to access file share from Azure WebApp via SMB protocol, you will need to connect Azure Web App to same VNET with VM and use following code:
// SMBConfiguration.cs
using System;
namespace NetFrameworkApp.Controllers
{
public class SMBConfiguration
{
public String GetSharePath()
{
return Environment.GetEnvironmentVariable("SMB_PATH");
}
public String GetUserName()
{
return Environment.GetEnvironmentVariable("SMB_USERNAME");
}
public String GetPassword()
{
return Environment.GetEnvironmentVariable("SMB_PASSWORD");
}
}
}
https://docs.pivotal.io/application-service-windows/2-8/smb-volumes-apps.html