exam questions

Exam AZ-300 All Questions

View all questions & answers for the AZ-300 exam

Exam AZ-300 topic 5 question 7 discussion

Actual exam question from Microsoft's AZ-300
Question #: 7
Topic #: 5
[All AZ-300 Questions]

HOTSPOT -
You are developing an Azure Function that will be triggered using a webhook from an external application. The Azure Function will receive JSON data in the body of the request.
Calling applications send an account ID as part of the URL. The number at the end of the URL is an integer. The format for the URL resembles the following: /api/ account/1
The Azure Function must accept all incoming requests without requiring keys or tokens.
You need to complete the attributes for the Azure Function.
How should you complete the code? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer: Explanation

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
tubadc
Highly Voted 5 years, 4 months ago
Maybe is: Block 1: FunctionName Block 2: HttpTrigger Block 3: Anonymous Block 4: /account/ Block 5: int accountId
upvoted 33 times
SinghJagdeep
4 years, 8 months ago
Block 4 is incorrect. As Function name is ProcessItem in this case. Route should be in this format Route="{functionName}/{parameter}" which means correct answer is ProcessItem/{accountId:int}
upvoted 1 times
ct84
4 years, 8 months ago
so, the name of the function is largely irrelevant for its operation.. it should be account/{accountId:int} because 'account' is actually part of the request
upvoted 3 times
ct84
4 years, 8 months ago
sorry, i should add that as soon as you specify the route.. the url changes to not consider the function name any longer UNLESS you do custom router in the host.json
upvoted 1 times
tartar
4 years, 8 months ago
Block 1: FunctionName Block 2: HttpTrigger Block 3: Anonymous Block 4: account/{accountId:int} Block 5: int accountId
upvoted 9 times
Freddo
4 years, 7 months ago
Agreed. "By default when you create a function for an HTTP trigger, or WebHook, the function is addressable with a route of the form http://<yourapp>.azurewebsites.net/api/<funcname>. You can customize this route using this route property. For example, a route of "products/{category:alpha}/{id:int}" would mean that the function is now addressable with the following route instead of the original route: http://<yourapp>.azurewebsites.net/api/products/electronics/357, which allows the function code to support two parameters in the address: category and id." Source: https://docs.microsoft.com/en-us/java/api/com.microsoft.azure.functions.annotation.httptrigger.route?view=azure-java-stable
upvoted 1 times
...
...
...
...
...
...
aHus
Highly Voted 4 years, 10 months ago
https://vceguide.com/how-should-you-complete-the-code-87/
upvoted 21 times
...
shaluvicky04
Most Recent 4 years, 7 months ago
Block 1: FunctionName Block 2: HttpTrigger Block 3: Anonymous Block 4: /account/ Block 5: int accountId
upvoted 1 times
...
misushant
4 years, 9 months ago
Block 1: FunctionName Block 2: HttpTrigger Block 3: Anonymous Block 4: ProcessItem/{accountId:int} Block 5: int accountId
upvoted 3 times
SinghJagdeep
4 years, 8 months ago
This is correct solution. Function name is ProcessItem in this case. Route should be in this format Route="{functionName}/{parameter}"
upvoted 1 times
ct84
4 years, 8 months ago
No, sorry this is NOT correct.. as soon as you specify router="account/{accountId:int}" the url at runtime is changed to no longer include the function name :s
upvoted 2 times
...
...
arseyam
4 years, 8 months ago
This is completely wrong..you don't need to put the function name in block4 Define the Route in the Function Header Routing can also be defined by modifying the HttpTrigger attribution in the header of the function, by default, this is set to null. Changing this value to ‘GetName’ will turn the URL into http://localhost:7071/api/GetName. https://www.codeproject.com/Articles/1275414/Azure-Functions-2-0-HTTP-Routing-Options#:~:text=Routing%20refers%20to%20the%20way,respond%20to%20a%20HTTP%20request.
upvoted 2 times
ct84
4 years, 8 months ago
i have worked with Azure Functions for a number of years now, and can confirm this is true - also true because i just checked! :)
upvoted 2 times
cttay71
4 years, 8 months ago
ct84, so what is the complete answer?
upvoted 2 times
...
...
...
...
tmurfet
4 years, 10 months ago
Reviewing the example at https://docs.microsoft.com/en-us/sandbox/functions-recipes/routes?tabs=csharp#adding-parameters-to-function-routes I now think that block 4 is: ProcessItem/{accountID:int} (ProcessItem is the function name). I now
upvoted 4 times
Gianlucag77
4 years, 10 months ago
I agree: block4 is <function name>/{accountID:int} where <functoin name> is defined in the block1 as ProcessItem
upvoted 2 times
uzairahm007
4 years, 5 months ago
check https://www.examtopics.com/user/Freddo/ comments
upvoted 1 times
...
...
...
AZViewer
4 years, 11 months ago
Answer is Block 1: FunctionName Block 2:HttpTrigger Block3:Anonymous Block4: account/{accountid:int} Block5: int accountId
upvoted 2 times
IndianIT
4 years, 11 months ago
From where you get this answer. I could not see any blocks over here
upvoted 1 times
denkes
4 years, 10 months ago
Search google for e.g.: "The format for the URL resembles the following: /api/ account/1" to see the question with boxes on other dump providing sites.
upvoted 1 times
...
...
...
MUSaeed
4 years, 11 months ago
https://books.google.ca/books?id=h0XbDwAAQBAJ&pg=PA155&lpg=PA155&dq=You+are+developing+an+Azure+Function+that+will+be+triggered+using+a+webhook+from+an+external+application.+The+Azure+Function+will+receive+JSON+data+in+the+body+of+the+request.&source=bl&ots=IEYDG8bEMD&sig=ACfU3U0cB2J-TzS8bFs2XFMj9c6qqyfExg&hl=en&sa=X&ved=2ahUKEwjb3YeM6-vpAhVTnp4KHWVUDGQQ6AEwBXoECAoQAQ#v=onepage&q=You%20are%20developing%20an%20Azure%20Function%20that%20will%20be%20triggered%20using%20a%20webhook%20from%20an%20external%20application.%20The%20Azure%20Function%20will%20receive%20JSON%20data%20in%20the%20body%20of%20the%20request.&f=false
upvoted 2 times
uzairahm007
4 years, 5 months ago
URL In not valid anymore
upvoted 1 times
...
...
tmurfet
4 years, 11 months ago
The "number" at the end of the URL is an "integer"... key word is integer, so... blocks 4 & 5 must be: account/{accountId:int} int accountId
upvoted 1 times
...
kumar123
4 years, 11 months ago
Block 1: FunctionName Block 2: HttpTrigger Block 3: Anonymous Block 4: account/{accountid:int} Block 5: int accountId
upvoted 14 times
jw_duke
4 years, 9 months ago
You have to use the custom http endpint to support "/account/1" as per the question https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook-trigger?tabs=csharp#customize-the-http-endpoint
upvoted 1 times
...
...
RegisK
4 years, 11 months ago
According to "Adding parameters to function routes" on page https://docs.microsoft.com/en-us/sandbox/functions-recipes/routes?tabs=csharp : Block 4 : ProcessItem/{accountId:int} because you rewrite the app function name here Block 5 : string accountId
upvoted 7 times
chaudh
4 years, 10 months ago
agreed
upvoted 1 times
...
praveen97
4 years, 9 months ago
As per the link, it seems the answer provided by RegisK is correct.
upvoted 1 times
jamhaneef
4 years, 4 months ago
Clearly shows that u need to read more. Please read this link.. incorrect answers. https://www.c-sharpcorner.com/article/routing-in-azure-function/#:~:text=Custom%20Routing%20using%20the%20Route,parameter%20is%20assigned%20as%20null.
upvoted 1 times
...
...
jamhaneef
4 years, 4 months ago
incorrect answer. Why upvote for these incorrect answers.Really misleading. Please read this link and come to conclusion. https://www.c-sharpcorner.com/article/routing-in-azure-function/#:~:text=Custom%20Routing%20using%20the%20Route,parameter%20is%20assigned%20as%20null.
upvoted 1 times
...
...
InsomniumBR
5 years, 3 months ago
For me it is a little bit wrong. The parameter account should be "account/{accountId}" Source: https://docs.microsoft.com/en-us/sandbox/functions-recipes/routes?tabs=csharp
upvoted 10 times
InsomniumBR
5 years, 3 months ago
Explaining better, the route should have the accountId parameter: "account/{accountId}"
upvoted 4 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago