问题
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.
回答1:
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.
回答2:
0
Yes I manage to achieve this buy Connecting to on-premises data sources with On-premises data gateway https://docs.microsoft.com/en-us/azure/analysis-services/analysis-services-gateway
steps followed to achieve this:
-create gateway to connect on-prem server (network folder)
Azure function - copy file to Azure blob Logic App to copy file from Azure blob to Network folder using File system connector(this connector uses the gate way to connect network folder created previously)
来源:https://stackoverflow.com/questions/55779648/access-shared-folder-via-azure-hybrid-connection