azure 功能无法访问本地网络

问题描述

我有一个 azure 触发器功能,我希望该服务从内部部署的文件夹中获取文件,然后处理它们。该文件夹是我们只能通过 VPN 访问的文件夹。该服务具有用于此的 VNET 配置,但仍无法访问该文件夹。

我该怎么办?

请告诉我为什么会出现此错误,或者我是否需要更改流程中的某些内容?提前致谢。

尝试 ping 文件夹地址,出现此异常

System.Net.networkinformation.PingException: An exception occurred during a Ping request. ---> System.ComponentModel.Win32Exception (5): Access is denied. at System.Net.networkinformation.Ping.InitialiseIcmpHandle() at System.Net.networkinformation.Ping.DoSendPingcore(IPAddress address,Byte[] buffer,Int32 timeout,PingOptions options,Boolean isAsync) at System.Net.networkinformation.Ping.Send(IPAddress address,PingOptions options) --- End of inner exception stack trace --- at System.Net.networkinformation.Ping.Send(IPAddress address,PingOptions options) at System.Net.networkinformation.Ping.Send(String hostNameOrAddress,PingOptions options) at ....

试图访问路径,得到下面的异常

System.UnauthorizedAccessException: Access to the path '\\\xxxxxx\test' is denied. at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path,Boolean ignoreNotFound) at System.IO.Enumeration.FileSystemEnumerator`1.Init() at ....

解决方法

您不能发起从 Azure Functions 到本地的连接,网络连接只能由连接到私有端点、服务提供商的客户端发起(在本例中为 Azure Functions strong>) 没有任何路由配置来启动与服务消费者的连接。只能在一个方向上建立连接。

如果 onprem 文件夹是 OneDrive 文件夹,您可以选择使用 Microsoft Graph API 发送到可能是您的函数应用程序的 webhook。详情在这里。

https://docs.microsoft.com/en-us/graph/webhooks

这只是我对您的方案所掌握的有限信息的一种选择。