I'm looking for a way to access the content of a shared folder in the network via Azure hybrid connections. I know I can access to SQL SERVER using Connection Manager, but is there a way to access files in the private network without creating a dedicated service in the on-premises system?
UPDATE: I added port 139 and 445 to the connection manager endpoints and shared a folder to everyone on the designated server. Then created an azure function with an App Service Plan that had access to my hybrid connection. I wrote the following code to test the connection to the shared folder:
public static IActionResult Run(HttpRequest req, ILogger log)
{
var files = Directory.GetFiles(@"\\ServerName\FolderName", "*.*", SearchOption.AllDirectories);
foreach (var file in files)
{
log.LogInformation(file);
}
return new OkResult();
}
When I run the function, I get "Access to the path is denied." error.
The App Service sandbox explicitly does not allow access to the ports necessary for SMB protocol (137/138/139/445).
This article mentions it under Restricted Outgoing Ports:
https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox.