azure - Azure Function v1 - 无法使用 PowerShell 获取 POST 正文内容
问题描述
我创建了一个运行时集为 64 位的 Azure Function v1 (PowerShell)。
我的 Azure Function 应该使用 PnP 在我的 SharePoint 网站上执行一些操作。
我已经在modules
文件夹上上传了 DLL,并且在函数启动时它们已正确加载。然后我尝试调用我的函数,在我的 POST 调用中将此 JSON 作为正文发送:
{
"name":"Test1"
}
我的功能(我已删除所有 SharePoint PnP 命令)是这个:
using namespace System.Net
param($Request, $TriggerMetadata)
$requestBody = Get-Content $Request -Raw | ConvertFrom-Json
$name = $requestBody.name
Write-Host $name
每次我运行该函数时,我都会收到一个错误 500 的输出:
{
"id": "xxxxxxxxxx",
"requestId": "xxxxxxxxxxxxxxx",
"statusCode": 500,
"errorCode": 0,
"message": "Exception while executing function: Functions.MyFunction-> PowerShell script error -> Cannot bind argument to parameter 'Path' because it is null."
}
我认为可以参考,Get-Content $Request
但我不知道如何修复此代码以使其正常工作。
解决方案
推荐阅读
- java - 如何在 O(1) 中选择方法
- reactjs - 如何在分页中同时设置“下一个和上一个”按钮
- codeigniter - 为什么在 URL 中没有 www 时 Codeiginiter 无法加载?
- django - 通过设置“Content-Disposition:attachment”(AWS S3 Bucket)实现“下载图像”功能
- python - 如何在python中使用BeautifulSoup在没有类名的范围内提取文本
- javascript - 通过特定键访问对象
- saml - 如何在 Okta 的属性中使用配置文件映射
- javascript - 如何在Vue JS中使用按字母顺序返回数组
- html - 如何获取html中生成的多个选择标签的ngValue
- dynamic - Pywasm 运行时错误