Azure Functions · AZ-204: Developing Solutions for Microsoft Azure Develop Azure Compute Solutions

You are developing a C HTTP-triggered Azure Function named SubmitOrder. Only clients that possess a function key should be able to invoke it. Which i…

Practice question from Azure Functions (AZ-204: Developing Solutions for Microsoft Azure Develop Azure Compute Solutions), with the correct answer and a step-by-step solution.

medium · MCQ · Q-A8D19B

You are developing a C# HTTP-triggered Azure Function named SubmitOrder. Only clients that possess a function key should be able to invoke it. Which implementation and request behavior meet the requirement?

  1. A.Decorate the function with [HttpTrigger(AuthorizationLevel.Function, "post", Route = "orders")] and send the key in the x-functions-key request header.Correct answer
  2. B.Decorate the function with [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "orders")] and send the key in the Authorization bearer token.
  3. C.Decorate the function with [HttpTrigger(AuthorizationLevel.Admin, "post", Route = "orders")] and send the key in the request body.
  4. D.Decorate the function with [HttpTrigger(AuthorizationLevel.Function, "post", Route = "orders")] and place the key in the response body returned by the function.

Solution

AuthorizationLevel.Function requires a function-level or host-level key. Clients can provide the key using the x-functions-key header or the code query-string parameter. Anonymous access does not require a key, and the key is not supplied in the response or request body.

More from Azure Functions

All of Azure Functions

Practise more Develop Azure Compute Solutions

Sign up free for adaptive practice on this chapter, with instant feedback and hints on every question.

Start practising free

Free to start · No credit card needed