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"
}
]
}