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 Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,371 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,487 questions
{count} votes

0 additional answers

Sort by: Most helpful