从 Azure Function 访问 Azure 文件存储 [英] Accessing Azure File Storage from Azure Function

查看:24
本文介绍了从 Azure Function 访问 Azure 文件存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 Azure 文件存储中检索要由在 Azure 函数中执行的 .exe 使用的文件,并且似乎无法通过 UNC 凭据.

I'm attempting to retrieve a file out of Azure File Storage to be used by an .exe that is executed within an Azure Function and can't seem to get pass the UNC credentials.

我的应用程序从 Azure SQL 数据库中获取 UNC 文件路径,然后尝试导航到该 UNC 路径(在 Azure 文件存储中)以导入文件的内容.我可以在 Windows 资源管理器中从我的 PC 导航到文件位置,但系统会提示我输入凭据.

My app gets the UNC file path out of an Azure SQL database and then attempts to navigate to that UNC path (in Azure File Storage) to import the contents of the file. I can navigate to the file location from my PC in windows explorer but am prompted for the credentials.

我在执行应用程序之前尝试使用net use"命令,但它似乎没有通过身份验证.

I've tried using a "net use" command prior to executing the app but it doesn't seem to authenticate.

net use \<storage account>.file.core.windows.net<directory> /u:<username> <access key>

MyApp.exe 

Azure 函数日志错误:

Azure Function Log error:

Unhandled Exception: System.UnauthorizedAccessException: Access to the path '<file path>' is denied.

如果可能,我宁愿不修改我的 C# 应用程序并在 Azure 函数中进行身份验证(目前它是一个批处理函数,并且将基于计时器).

If possible, I'd rather not modify my C# app and do the authentication in the Azure Function (its a Batch function at the moment and will be timer based).

推荐答案

我认为在 Azure Function 中挂载 Azure File Service Share 是不可能的不要访问底层基础架构(相同处理为 WebApps).

I believe it is not possible to mount an Azure File Service Share in an Azure Function as you don't get access to underlying infrastructure (same deal as WebApps).

您可以做的是使用 Azure Storage SDK,它是 Azure Storage REST API 的包装器,并在您的应用程序中使用它与您的文件中的文件进行交互服务共享.

What you could do is make use of Azure Storage SDK which is a wrapper over Azure Storage REST API and use that in your application to interact with files in your File Service Share.

这篇关于从 Azure Function 访问 Azure 文件存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆