I have an Azure Function App that accepts two CSV files and a date string as input (via multipart/form-data) and returns a combined Excel file.
- The function works correctly when tested locally or when triggered remotely via Postman (using the
multipart/form-datacontent type). - However, I encounter issues when trying to test it from the Azure Portal using the Code + Test screen, as well as when calling it from an HTTP trigger in a Logic App.
Function Overview:
- HTTP trigger (POST)
- Accepts 2 CSV files and a string date (all via
multipart/form-data).
What Works:
- Testing the function locally or remotely after deploying to Azure using Postman works fine. I pass two base64-encoded CSV files and the date string using
multipart/form-data, and the function processes and returns the Excel file as expected.
Issues:
Azure Code + Test screen:
- When I test the function here, I can’t seem to pass the CSV files and date string properly. I get blank values in the function logs for the inputs, even though the function runs without any errors.
- I am unsure how to correctly structure the inputs using the Code + Test interface, which uses query input fields. If I pass it as json in the body section, it throws an exception when it tries to read it from the result. If I pass it in the query fields as key value pairs it reads all three values as null without throwing an exception.
Logic App HTTP trigger:
- When I call the function from my Logic App, I’m using an HTTP action after a Create CSV Table action to pass the CSV files and a date string, but the function does not receive the data correctly. The CSV content and the date string aren’t being parsed as expected by the function.
Questions:
- How can I properly test the Azure Function using the Code + Test screen in the portal when passing two CSV files and a string date?
- What is the correct way to structure the HTTP action in a Logic App to send two CSV files and a date string to my Azure Function App using
multipart/form-data?
What I’ve Tried:
- I’ve set the
Content-Typetomultipart/form-datain the Logic App's HTTP action and used@{body('Create_CSV_Table')}to pass the CSV content, but I’m unsure if I’m constructing the multipart body correctly. - I’ve also used logging (
_logger.LogInformation) inside the function to check what’s being received, but the fields for the CSV files and the date string are blank when using Code + Test or Logic App, while they show correct values when tested via Postman.
Any guidance on how to structure the request from both the Logic App and the Code + Test screen would be greatly appreciated!
Code to Read the Parameters from the Request:
This is the code I am using to read the parameters from the HTTP request in the Azure Function:
var form = await req.ReadFormAsync();
var file1Base64 = form["file1"];
var file2Base64 = form["file2"];
var stringDate = form["stringDate"];

