azure - Azure Powershell Function App 从 Data Lake Gen 1 读取内容
问题描述
对于这个问题的任何帮助,我将不胜感激。
我要做的就是使用一个简单的 Azure 函数应用程序,使用 Powershell 从我的数据湖中读取文件(“/input/specimen.json”),使用它,然后最终将其写回湖中。我已经被困住了。
以下是函数应用程序中的相关代码:
# The below line is at the very top of the function app run.ps1
using namespace System.Management.Automation.PSCredential
# The lines below are in the main area of the function app which are called.
$path = "/input/specimen.json"
$account = "mydatalake"
$tenant = "<my-tenant-id>"
$user = "<application/client id>"
$pass = "<client secret>"
$password = ConvertTo-SecureString $pass -AsPlainText -Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $user,$password
connect-azaccount -credential $cred -tenant $tenant -ServicePrincipal
$data = Get-AzDataLakeStoreItemContent -accountname $account -path $path
write-host $data
$body = $data | out-string
disconnect-azaccount
函数应用的输出是:
2020-06-04T19:49:09Z [错误] 错误:Get-AzDataLakeStoreItemContent:打开文件 /stan/interests.json 的读取流时出错。操作:GETFILESTATUS failed with HttpStatus:Forbidden RemoteException: AccessControlException GETFILESTATUS failed with error 0x83090aa2(禁止。ACL 验证失败。资源不存在或用户无权执行请求的操作。)。[a6cfab98-149a-46eb-8cb6-bd0a40a11796] 失败,错误为 0x83090aa2(禁止。ACL 验证失败。资源不存在或用户无权执行请求的操作。)。[a6cfab98-149a-46eb-8cb6-bd0a40a11796][2020-06-04T12:49:08.1314705-07:00] JavaClassName:org.apache.hadoop.security.AccessControlException。
ACLS 和权限的错误,但我已经设置了一个服务主体以用于“connect-azaccount”,并使该 SP 既是数据湖的贡献者又是所有者,但仍然得到相同的错误。我有理由确定我正在使用的 SP 正在用于身份验证,因为 Function App 日志显示创建的会话正在使用正确的租户和客户端 ID 回显到主机。
这开始让我发疯了。我还需要什么才能让它工作?是否需要其他角色或权限?有一个更好的方法吗?
任何和所有的帮助将不胜感激 - 在此先感谢。
解决方案
推荐阅读
- python - 如何在 ScalarFormatter 之后更改对数图的 xticks 和 yticks?
- c# - 如何向单个动态生成的对象添加点击事件?
- python-3.x - 播放器在屏幕上正确时闪烁,python和pygame
- c# - 上午 12 点至上午 6 点之间减少的负面结果
- sql-server - 更长的 SQL Server 作业历史
- android - 如何使用 OnNavigationItemSelectedListener 关闭片段以查看下面的活动
- javascript - 如何在身份验证期间更改 this.state 状态?Firebase + 反应路由器
- javascript - React MUI:持久+响应式抽屉
- spring-security - 缺少 Id_Token Spring Oauth2 身份验证服务器和 mod_auth_openidc
- amazon-web-services - Neo4j:服务不可用:Websocket 连接失败