Function inputs with query or path support should be able to make use of query/body parameters
The documentation for SqlQuery inputs mentions that this capability is not yet supported, and points to a GH comment, but I saw no actual feature request so here it is.
"You can pass route data to the SqlQuery parameter as shown, but currently you can't pass query string values." (link to comment https://github.com/Azure/azure-functions-host/issues/2554#issuecomment-392084583)
Is there any sort of timeline that users can expect this?
Also, I think the documentation could be improved to explain that the Route Templates are based on ASP.NET routing, which is where the limitation stems from (because route templates in ASP.NET do not encompass query parameters since they're not technically part of the route/path). It took a long time for me to track down the why, and I think including that in the documentation would help others in my situation understand what the limitations are (and therefore that they need to work around them).
A little background for how I got here. I wanted to include two parameters in the path so that I could use them in the SqlQuery for the Cosmos DB input, so I structured the route template for the function as follows:
I then realized that both p1 and p2 have the potential to have forward-slashes in them, which screws up the templating because the resulting path would actually be something like
I still need the variables to inject into my query, so I then changed the route template (not knowing it was not supported) to:
The portal makes NO complaints when I enter this until I go back to the area in the portal where I can modify/run/test code, where I get a red popup notification that says:
"Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.functionName'. System.Web.Http: The route template cannot start with a '/' or '~' character and it cannot contain a '?' character.
Parameter name: routeTemplate."
So, I think my asks are:
- Query/Body parameter support for SqlQuery
- Improved documentation for CosmosDB input binding to describe what the route templates are based on (and their limitations)
- Some examples of valid vs. invalid would be helpful
- Update portal to include real-time validation of the input for the Azure function route template
This is some awesome functionality!
We will update this item when there is a plan to implement it.
Thanks for the feedback!
Azure Functions Team