Before moving ahead, have a look at our Azure tutorial prepared by industry experts
Introduction to Azure Functions
Azure Functions are serverless solutions that allow you to write less code, maintain less infrastructure, and save on costs. Instead of worrying about deploying and maintaining servers, the cloud infrastructure provides all the up-to-date resources needed to keep your applications running. Azure Functions provides a feature called ‘compute on demand’. This is for the system to respond to a series of events.
This is done in two ways:
- Azure Functions allows the users to implement their logic in particular pieces of code. These are known as “functions”. Various functions run at various times of response.
- When the requests increase, Azure Functions create as many resources and function instances as required as per the need. Again, when the requests decrease, the extra resources and function instances are deleted automatically.
List of Azure Functions
|Task required to be done||What can be done|
|Build a web API||Use HTTP trigger|
|Process file uploads||Run code when blob storage is updated|
|Serverless workflow||Use series of functions|
|Database changes response||Run code when Cosmos DB is updated|
|Run schedule tasks||Run code at a particular time|
|Message Queue System||Use Queue Storage, Service Bus, Event Hubs|
|IoT data streams||Process data from IoT devices|
|Process real-time data||Use Functions and SignalR|
Get 100% Hike!
Master Most in Demand Skills Now !
Learn more about Azure from our blog on Azure tutorial now!
Durable Functions in Azure Functions
Durable Functions are extensions of Azure Functions that lets you write stateful functions in a serverless compute environment. Durable functions help in defining stateful workflows and stateful entities using the Azure Functions programming model. Durable functions only support the following languages currently:
Supports both pre-compiled libraries and C# script.
Supports only version 2.x for the Azure Functions runtime.
Requires 2.3.1 version or above.
Supports both pre-compiled libraries and F# script. Only for the 1.x version.
Supported only for the 3.x version of the Azure Functions runtime.
Let us compare the automation services to know what will suit best as our requirements:
Microsoft Power Automate VS Azure Logic Apps
|Power Automate||Logic Apps|
|The users are office workers, business users, SharePoint administrators||The users usually are professional integrators and developers, IT professionals|
|Used for self-service scenarios||Used in case of advanced integrations|
|The design tools for mobile and browser are UI only||In browser and visual code, code views are available|
|Design and test are conducted in non-production environments and promoted to production when ready||Azure DevOps solely manages source control, testing, support, automation, and manageability in Azure Resource Manager|
|Admin can manage Power Automate environments and data loss prevention (DLP) policies, track licensing is done in Admin center||Admin can manage resource groups, connections, access management, and logging is done in Azure portal|
|For security, Microsoft 365 security audit logs, DLP, encryption at rest for sensitive data are present||The security assurance of Azure has Azure security, Azure Security Center , and audit logs|
Have a look at our blog on Azure interview questions and excel at your job interview!
Durable Functions VS Logic Apps
|Durable Functions||Logic Apps|
|Code is developed first||Design is developed first|
|For connection, it has many built-in bindings||Has a large collection of collectors|
|Every activity is an Azure Function. Codes can be written for custom functions||Contains a large collection of ready-made actions|
|Monitoring is done by Azure Application Insights||Monitoring is done through the Azure portal and Azure Monitor Logs|
|REST API and Visual Studio manage the things||Azure portal, REST API, PowerShell, Visual Studio together manage the things|
|This can run locally in the cloud||This only runs in the cloud|
Benefits of using Azure Functions
- Azure Functions provide a very simplified and user-friendly development environment
- A separate server is not necessary to maintain the Azure Functions
- Azure Functions help to break down very big architectures into smaller codes
- Azure Functions provide independent scaling
Consumption Plan Costs of Azure Functions
The execution cost of a single function is measured in GB-seconds. This is done by combining memory usage and the particular execution time. Function runtime and Memory consumption by the function are both directly proportional to the cost.
Suppose that the function consumes 1 GB in 2 seconds, then the execution cost would be
1GB * 2s = 2GB-s
Memory usage is rounded up to the nearest 128 MB bucket.
While using functions related to HTTP, if an error occurs before the function code is executed, the charges are not applied. Similarly, status codes in 500s are not counted if they occur before the execution of the function. However, if a status code in 500s occurs after the function has started to execute, it will be counted.
Other Costs related to Azure Functions
When estimating the overall cost of running your functions in any plan, remember that the Functions runtime uses several other Azure services. When calculating pricing for Azure function apps, any triggers and bindings you have that integrate with other Azure services require you to create and pay for those additional services.
Cost related to storage in Azure Functions
Each function app requires that you have an associated General Purpose Azure Storage account. This account is used internally by the Functions runtime, but you can also use it for Storage triggers and bindings. If you don’t have a storage account, one is created for you when the Azure function app is created.
Functions rely on this for high-performance monitoring. A free grant of telemetry data is included every month.
We do not need to pay for data transfer between Azure services in the same region. However, we might incur costs for outbound data transfers to another region or outside of Azure.
Enroll in our Azure Training curated by industry experts and get certified!
Azure Functions Tutorial
1. Goto the search bar and search for function App and open it
2. Click on create to create a new function app.
3. Fill in the details and proceed to click on Review + Create
4. If you are satisfied with the review, click on Create at the bottom
5. Wait for a minute or two until the function app gets created. You can check the status by clicking on the notification icon (bell icon).
6. Once the status turns to green, that is, a tick mark as shown, click on the go-to resource to proceed. This will take us inside the function app.
7. This is how the created function app will look. Check the left column for Functions and click to proceed.
8. After this, click on add, to create a new function.
9. Choose the Develop in portal option and choose the HTTP trigger as the template and click on add below.
10. Wait for the function to be created and click on Code + Test.
11. After this, click on the Get function URL.
12. Paste the URL on the browser and check if it is loading. If not, recheck the process.
13. It asks to pass a name as a string.
At the end of the URL, type &name=”AbC”
AbC is just an example name, anything can be used in place of that.
Like it can be seen in the given picture, the name gets reflected on the page. This is done by the HTTP trigger function which we created.
Caught up with doubts? Ask them out in our Azure community right away!