Azure Function Powershell Outputbinding to blob storage produces no output

Nick Muldrew 21 Reputation points
2020-12-15T03:08:31.67+00:00

I Have a Azure Function written in PowerShell that is running a Query against a Database and Saving it into a object. (Yes it is getting a Result from the Query) I'm trying to Get it to Save that output as a Blob using a Output Binding. However it is not saving anything nor is it Producing any Errors from the Log Stream.

run.ps1
using namespace System.Net

param($name)

"Hello $name!"

$ConnectionStr = 'connectionstring'
# $ConnectionStr = $env:sqldb_connection

$Query = 'SELECT *
     FROM [SalesLT].[ProductCategory]';

$testoutput = Invoke-Sqlcmd -ConnectionString $ConnectionStr -Query $Query
# $testoutput
$csvOutputTest = $testoutput | ConvertTo-Csv -NoTypeInformation
# $csvOutputTest
$testString = "Yo this is a string"
# $data = Get-Content $csvOutputTest
Write-Output outputBlob -Verbose
Write-Output "testing" -Verbose
# Out-File -FilePath $outputBlob -InputObject $csvOutputTest

Push-OutputBinding -Name resp -Value ([HttpResponseContext]@{
    StatusCode = [HttpStatusCode]::OK
    Body = "Hello"
})

Push-OutputBinding -Name Return -Value $csvOutputTest
# $csvOutputTest | Push-OutputBinding -name outputBlob

function.json
{
"bindings": [
{
"name": "name",
"type": "activityTrigger",
"direction": "in"
},
{
"name": "Return",
"path": "csvstorage/{rand-guid}",
"connection": "AzureWebJobsStorage",
"direction": "out",
"type": "blob"
},
{
"name": "resp",
"direction": "out",
"type": "http"
}
]
}

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
1,414 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
2,606 questions
{count} votes

Accepted answer
  1. Pramod Valavala 14,546 Reputation points Microsoft Employee
    2020-12-15T15:18:28.907+00:00

    Looking at the PowerShell worker code, this seems to not be supported just yet (non $return output bindings). Note that Durable Function support for PowerShell is still in preview.

    It would be best to open an issue on the PowerShell worker repo for a more insightful discussion.

    No comments

0 additional answers

Sort by: Most helpful