使用powershell设置azure函数的blob名称
我正在尝试使用powershell在Azure函数中设置(更改)blob的文件名 通过使用powershell设置azure函数的blob名称,powershell,azure-functions,azure-storage-blobs,azure-blob-storage,Powershell,Azure Functions,Azure Storage Blobs,Azure Blob Storage,我正在尝试使用powershell在Azure函数中设置(更改)blob的文件名 通过function.json { "bindings": [ { "name": "InputBlob", "type": "blobTrigger", "direction": "in", "path&q
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"
}
]
}
并在my run.ps1中组装$newname
执行Push-OutputBinding-Name$OutputBlob-Value$Blob
时存在一个问题,即它希望字节[]-数组没有名称属性
因此,绑定配置只是获取输入给定的参数。
无法传递字节[]-数组以外的内容。。。
这就是为什么我总是
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}\u输出
能否请您指定使用“newfilename”的位置?我试图在函数代码中将newname设置为var,但似乎无法在函数中计算完整的新文件名。为了存档,我通常试图在名称中添加时间戳。我试图在函数代码中将newname设置为var,但似乎无法在函数中计算完整的新文件名。为了存档,我通常会尝试在名称中添加时间戳