【发布时间】:2021-06-01 15:33:46
【问题描述】:
我正在尝试设置在 blob 存储容器中创建文件时触发的 Powershell Azure 函数。该函数需要处理blob文件并将其保存到不同的blob存储容器中。
目前该函数什么都不做,因为我正在尝试处理下面的问题。
我无法从 powershell 函数内部访问 blob。我能够在 c# 中使用 Attributes 实现这一点,但似乎 powershell 不支持 Attributes。
我尝试在我的函数的集成选项卡下添加一个 Azure Blob 存储输入,路径为“container-name/{name}”。但这只会导致错误:“命名参数'name'没有值。”
如何使用事件网格触发器从 powershell 函数访问 blob?
谢谢!
功能:
param($eventGridEvent, $TriggerMetadata, $inputBlob)
$fileName = $TriggerMetadata.Name;
Write-Host "file name: $($fileName)";
Push-OutputBinding -Name outputBlob -Value $fileName
函数.json
{
"bindings": [
{
"type": "eventGridTrigger",
"name": "eventGridEvent",
"direction": "in"
},
{
"name": "outputBlob",
"path": "https://storage01.blob.core.windows.net/container-name",
"connection": "Storage01ConnectionString",
"direction": "out",
"type": "blob"
},
{
"name": "inputBlob",
"path": "container-name/{name}",
"connection": "Storage01ConnectionString",
"direction": "in",
"type": "blob"
}
]
}
【问题讨论】:
标签: powershell azure-functions azure-eventgrid