使用powershell设置azure函数的blob名称



我正在尝试使用powershell设置(更改(Azure函数中blob的文件名。

function.json运行良好

{
"bindings": [
{
"name": "InputBlob",
"type": "blobTrigger",
"direction": "in",
"path": "container-src/{name}.{ext}",
"connection": "stacqadbdev_STORAGE"
},
{
"name": "OutputBlob",
"type": "blob",
"direction": "out",
"path": "container-dest/{name}",
"connection": "stacqadbdev_STORAGE"
}
]
}

这只是将blob的名称"复制"到另一个容器。

一旦我想将目的地blobname更改为在我的功能范围内计算的内容,我就失败了。

我试着设置

{
"bindings": [
{
"name": "InputBlob",
"type": "blobTrigger",
"direction": "in",
"path": "container-src/{name}",
"connection": "stacqadbdev_STORAGE"
},
{
"name": "OutputBlob",
"type": "blob",
"direction": "out",
"path": "container-dest/{newname}",
"connection": "stacqadbdev_STORAGE"
}
]
}

并在我的运行.ps1 中组装$newname

执行Push-OutputBinding -Name $OutputBlob -Value $Blob的问题是,它希望拥有Byte[]-Array,该数组的名称没有属性。

因此,绑定配置只是采用输入提供的参数。传递Byte[]-数组以外的其他内容是不可能的。。。这就是为什么我总是得到

Executed 'Functions.CreateVaultEntry' (Failed, Id=775e61ce-b001-4278-a8d8-1c90ea63c062, Duration=91ms)
System.Private.CoreLib: Exception while executing function: Functions.CreateVaultEntry. 
Microsoft.Azure.WebJobs.Host: No value for named parameter 'newfilename'.

我只想取inputBlob,更改它的名称,并用另一个名称将其写为outputBlob

什么是newname

当您的函数被触发时,并且在触发器中,您正在绑定到{name},那么您的其他绑定将知道{name},但{newname}没有意义。

也许你想要的是container-dest/{name}_output

更多信息。

最新更新