Create serverless logic with Azure Functions Flashcards

1
Q

Which type of function is best suited for Azure Functions, Stateless or Stateful?

A

Stateless, as functions are created and destroyed on demand

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Can Azure functions be deployed to non-serverless environments?

A

Yes, by default Azure functions are Serverless but they can also be deployed to non-serverless environments.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the default timeout for Azure functions?

A

5 minutes, 2.5 minutes for HTTP response based functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the scaling limitations of Azure functions?

A

A new Azure function instance can be created every 10 seconds only and upto max of 200 instances.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are factors that help deciding in use of serverless Azure function computing?

A
  • Execution Time
  • Execution Frequency
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Where are Azure functions hosted?

A

Azure functions are hosted in execution context called as Function App.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What type of service plans can be used by Function App?

A
  • Consumption plan
  • Azure App Service plan
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

When should you use App Service plan for Azure Function App?

A
  • Execution time is more than 5 mins
  • Function needs to run continuously
  • Function requires more processing power
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the use of a Storage account when configuring Azure Function App?

A
  • Internal operations like logging, and managing execution triggers
  • In-case of the Consumption plan, this is where function code and configuration files are stored
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the 8 services for which Azure provides triggers for Azure Functions?

A
  • Azure Blob storage
  • Cosmos DB
  • Azure Service Bus
  • Queue Storage
  • HTTP
  • Event Grid
  • Microsoft Graph Events
  • Timer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are bindings in Azure Functions?

A

Binding is a declarative way of connecting data and services to Azure Functions. Bindings have direction like input binding and output binding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How can you add logging to Azure functions?

A

Azure function is passed a logging object in each language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the default Authorization type when creating a Azure function?

A

Function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what is the HTTP header used to send the function key when executing Azure Functions via HTTP?

A

x-function-key

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the input parameters to Timer Trigger for Azure functions?

A

There are two parameters:
- Timestamp
- Schedule - CRON

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are a few capabilities of using the HTTP Trigger for Azure Functions?

A

HTTP triggers have many capabilities and customizations, including:

  • Provide authorized access by supplying keys.
  • Restrict which HTTP verbs are supported.
  • Return data back to the caller.
  • Receive data through query string parameters or through the request body.
  • Support URL route templates to modify the function URL.
17
Q

What is HTTP Trigger Authorization level?

A

It helps authorize the trigger to be executed only if the API key is supplied for authentication

18
Q

What are the authorization levels for HTTP Triggers?

A

There are three Authorization levels:

  • Function
  • Anonymous
  • Admin
19
Q

What are the types of keys required for Authorized HTTP triggers?

A

There are two types of Authorization Keys:
- Function (scopes: Admin, Function)
- Host (scope: Admin)

20
Q

What are the basic few configurations for Azure Function bindings?

A

There are a few basic configurations for Azure bindings:
- Name: function parameter to access data
- Type: Type of bindings
- Direction: Direction of data
- Connection: App setting key with connection string

21
Q

What is a binding expression?

A

A binding expression is specialized text in function.json, function parameters, or code that is evaluated when the function is invoked, to yield a value

22
Q

What are the different types of binding expressions?

A

There are several types of binding expressions:
- App settings
- Trigger filename
- Trigger metadata
- JSON payloads
- New GUID
- Current date and time

23
Q

What are the extra properties added to the Azure Cosmos DB document on creation?

A

Following are the properties added to the document created:
- _ts: timestamp
- _etag: for concurrency control
- _rid: resource identifier
- _self: Unique addressable URI for the resource
- _attachments: Addressable path for the attachment resource

24
Q

What are Durable Functions?

A

Durable Functions allows you to implement complex stateful functions in a serverless-environment. They can retain state between function calls.

25
Q

What are the benefits of Durable Functions?

A

Some benefits of using Durable Functions include:

  • They enable you to write event driven code. A durable function can wait asynchronously for one or more external events, then perform a series of tasks in response to these events.
  • You can chain functions together. You can implement common patterns such as fan-out/fan-in, which uses one function to invoke others in parallel, then accumulate the results.
  • You can orchestrate and coordinate functions and specify the order in which functions should execute.
  • The state is managed for you. You don’t have to write your own code to save state information for a long-running function.
26
Q

What is an Orchestration function?

A

An orchestration function allows you to define stateful workflows in Durable Functions provides these extra benefits:

  • You can define the workflows in code. You don’t need to write a JSON description or use a workflow design tool.
  • Functions can be called both synchronously and asynchronously. Output from the called functions is saved locally in variables and used in subsequent function calls.
  • Azure checkpoints the progress of a function automatically when the function awaits. Azure may choose to dehydrate the function and save its state while the function waits, to preserve resources and reduce costs. When the function starts running again, Azure will rehydrate it and restore its state.
27
Q

What are the types of Durable functions?

A

There are three durable function types:
- Client functions are the entry point for creating an instance of a Durable Functions orchestration. (any language)
- Orchestrator functions describe how actions are executed, and the order in which they are run. (C# and JS)
- Activity functions are the basic units of work in a durable function orchestration. An activity function contains the actual work performed by the tasks being orchestrated.

28
Q

What are common examples of Workflow patterns?

A

Common workflow patterns are:
- Function chaining - In this pattern, the workflow executes a sequence of functions in a specified order.
- Fan out/fan in - This pattern runs multiple functions in parallel and waits for all the functions to finish. You can aggregate the results of the parallel executions or use them to compute a final result.
- Async HTTP APIs - This pattern addresses the problem of coordinating state of long-running operations with external clients. An HTTP call can trigger the long-running action. Then it can redirect the client to a status endpoint. The client can learn when the operation is finished by polling this endpoint.
- Monitor - This pattern implements a recurring process in a workflow, possibly looking for a change in state.
- Human interaction - This pattern combines automated processes that also involve some human interaction.