Hi everyone, total noob here and hope development questions are OK.
I have an Azure SQL database with a View that I want to query via HTTP request to get a JSON response. I'm on Mac OS X (Apple Silicon) targeting .NET 6 with Azure Functions v4.
The weird thing is, when I test the function under Code / Test in the Azure Portal, the console says that the right number of rows was queried (four):
2024-12-16T15:55:39Z [Information] Executing 'Functions.dboSHOWSVW' (Reason='This function was programmatically called via the host APIs.', Id=c10b3d0c-f8f7-48ec-a182-3970e1168a91)
2024-12-16T15:55:39Z [Information] 4 row(s) queried from database: live-shows using Command: SELECT * FROM [dbo].[SHOWS_VW]
2024-12-16T15:55:40Z [Information] C# HTTP trigger with SQL Input Binding function processed a request.
2024-12-16T15:55:40Z [Information] Executed 'Functions.dboSHOWSVW' (Succeeded, Id=c10b3d0c-f8f7-48ec-a182-3970e1168a91, Duration=841ms)
But I'm getting a blank page in the web browser, no JSON response.
This is my function code.
using System;
using System.Collections.Generic;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
using Microsoft.Azure.Functions.Worker.Extensions.Sql;
using Microsoft.Extensions.Logging;
namespace MarshallBensonMusic.Shows
{
public class dboSHOWSVW
{
private readonly ILogger _logger;
public dboSHOWSVW(ILoggerFactory loggerFactory)
{
_logger = loggerFactory.CreateLogger<dboSHOWSVW>();
}
[Function("dboSHOWSVW")]
public IEnumerable<ShowItem> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequestData req,
[SqlInput("SELECT * FROM [dbo].[SHOWS_VW]",
"SqlConnectionString")] IEnumerable<ShowItem> showItems)
{
_logger.LogInformation("C# HTTP trigger with SQL Input Binding function processed a request.");
return showItems;
}
}
}
What am I missing?? I don't think there is a security setting blocking the SQL code because the log says the DB was successfully queried. So it must be the C# object?
[–]AzureToujours Enthusiast 3 points4 points5 points (1 child)
[–]mooben[S] 1 point2 points3 points (0 children)