I am trying to set (change) the filename of a blob within a Azure function with powershell.
It is working great by 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"
}
]
}
which is just 'copying' the blob's name to another container.
As soon as I want to change to destinations blobname to something which is calculated within my function I am failing.
I tried to set
{
"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"
}
]
}
and assembling $newname in my run.ps1
Doing Push-OutputBinding -Name $OutputBlob -Value $Blob
has the issue that it wants to have the Byte[]-Array which has no properties for its name or so.
So, the bindings configuration is just taking the parameters given by input. Passing something else than the Byte[]-Array is not possible... That's why I always get
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'.
I just want to take the inputBlob
, change it's name and write it as outputBlob
with another name.