Passing data to function does not work using the provided command

Royer, Alexis 20 Reputation points
2025-02-01T16:43:05.1366667+00:00

Hi,
in Exercise - Add logic to the function app - Secure HTTP triggers
the data section of the following command never pass the name variable correctly to the function on the function app. it run but ignore the fact that a variable was passed.

is it still the proper command as of today? I've tried with different combinaison of single or double quote.. can't seems to find the proper usage.

curl --header "Content-Type: application/json" --header "x-functions-key: <your-function-key>" --request POST --data "{\"name\": \"Azure Function\"}" <your-https-url>

This question is related to the following Learning Module

Azure Training
Azure Training
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Training: Instruction to develop new skills.
2,253 questions
{count} votes

Accepted answer
  1. Pradeep M 6,650 Reputation points Microsoft External Staff
    2025-02-11T04:07:21.4766667+00:00

    Hi Royer, Alexis

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to accept the answer. 

    Ask: Passing data to function does not work using the provided command 

    Solution: I found the issue. The issue is that the function is case sensitive. Name variable should either be replaced with a minus "n" in the function like below, or pushed using uppercase "N" in the data json.

    That's why if we follow the tutorial line by line, it won't works because in the function the "'N" is uppercase but in the json body it's lowercase "n".

    
    $name = $Request.Query.Name
    if (-not $name) {
        $name = $Request.Body.name
    }
    

    If you have any further questions, please feel free to ask,thank you again for your time and patience in resolving this issue. 

    If you found this information helpful, please consider accepting the answer and selecting "Yes" for "Was this answer helpful?" This can benefit other community members as well. 

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.