Saeid
Saeid

Reputation: 1663

Access Shared Folder Via Azure Hybrid Connection

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.

Upvotes: 3

Views: 1950

Answers (2)

Veera Induvasi
Veera Induvasi

Reputation: 822

Yes I manage to achieve this buy Connecting to on-premises data sources with On-premises data gateway Link

steps followed to achieve this:

  1. create gateway to connect on-prem server (network folder)
  2. Azure function - copy file to Azure blob
  3. 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)

Upvotes: 0

DixitArora-MSFT
DixitArora-MSFT

Reputation: 1811

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.

Upvotes: 2

Related Questions