Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Learning Azure Functions
Learning Azure Functions

Learning Azure Functions: Build scalable cloud systems with serverless architecture

Arrow left icon
Profile Icon Manisha Yadav Profile Icon Mitesh Soni
Arrow right icon
$43.99
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3 (3 Ratings)
Paperback Sep 2017 240 pages 1st Edition
eBook
$9.99 $35.99
Paperback
$43.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Manisha Yadav Profile Icon Mitesh Soni
Arrow right icon
$43.99
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3 (3 Ratings)
Paperback Sep 2017 240 pages 1st Edition
eBook
$9.99 $35.99
Paperback
$43.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$9.99 $35.99
Paperback
$43.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Learning Azure Functions

Introducing Microsoft Azure Services and Functions

"Believe in yourself! Have faith in your abilities! Without a humble but reasonable confidence in your own powers you cannot be successful or happy."
- Norman Vincent Peale

This is an era of buzzwords. The moment we become familiar with one buzzword, another emerges and we start chasing it again. It started with cloud computing, DevOps, and now serverless computing.

This chapter introduces some of the fundamental concepts and terminology to give the reader a baseline understanding of cloud computing, cloud service models, and cloud deployment models. We will also understand what functions are and get acquainted with some of the related concepts of Microsoft Azure.

We will use a free trial of Azure Functions to get familiar with it. We will execute the sample function of printing Hello World! using Azure Functions.

The following are the topics that we will cover in this chapter:

  • An overview of serverless architectures
  • Why functions?
  • An overview of Microsoft Azure services
  • Azure App Services versus Azure Functions versus AWS Lambda

An overview of serverless architectures

Since the introduction of cloud computing, we have used The Blind Men and an Elephant story for different technology evolutions and trends. It becomes easier to convey that there is no clear definition of it and based on experience we define it differently based on our wisdom. There may not be any drastic difference but the view might be different. Reality is one, though wise men speak of it variously.

Let's understand serverless architecture by taking the story of blind men and an elephant:

According to this story of The Blind Men and an Elephant, the blind men decide to define an elephant by touching it and then come to their own conclusions:

  • The first person placed his hand upon the elephant's trunk and said, "It feels like ... a thick snake"
  • The second person placed his hand upon the elephant's ears and said, "It feels like ... a kind of fan"
  • The third person placed his hand upon the elephant's legs and said, "It feels like ... a tree-trunk"
  • The fourth person placed his hand upon the elephant's body and said, "It feels like ... a wall"
  • The fifth person placed his hand upon the elephant's tail and said, "It feels like ... a rope"
  • The sixth person placed his hand upon the elephant's tusks and said, "It feels like ... a spear"

So, there are different perspectives, but the elephant remains the same. There are many perspectives, views, and definitions available for serverless architectures or serverless computing.

Let's understand serverless architecture with respect to the evolution of computing:

Based on the pattern of usage, the use of an on-premise resource evolved into the use of to serverless computing.

Cloud computing and service models

Change is a step-by-step process to evolve and make the existing practices more effective with enhancements. If we can find a pattern, then change/evolution is a driving force behind all path-breaking innovations. Similarly, cloud computing is a disruptive innovation in the field of infrastructure in Information Technology.

George Bernard Shaw was wise enough to say that:

"Progress is impossible without change, and those who cannot change their minds cannot change anything."

This is very appropriate for cloud computing and its adoption in the small, medium, or even large organization.

Let's understand what cloud computing is! It is no longer the elephant in the room. There are many good definitions available in the market, but I will explain what I understand and what I have experienced.

Cloud computing and its basics

Cloud computing is a kind of system that provides on-demand and agile resources in a pay-as-you-go billing model, multitenant, or dedicated computing resource such as compute, storage, and network. As per NIST definitions, cloud computing comes with four cloud deployment models and three cloud service models as given in the following diagram:

Cloud deployment models define the way resources are deployed in the environment such as on-premise and exclusively for a specific organization, that is, a private cloud; or cloud resources that are accessible to all organizations and individuals over the internet, that is, a public cloud; or cloud resources that are accessible to a specific set of organizations that share similar interests or requirements, that is, a community cloud; or cloud resources that combine two or more cloud deployment models that is known as a hybrid cloud.

There are three cloud service models that define the way cloud resources are made available to users.

Infrastructure as a Service (IaaS): Cloud resources can be Infrastructure as a Service (IaaS), where the user is responsible for managing and maintaining resources/virtual machine starting, from package installation to security configuration and from upgrading packages to configuring resources for high availability as well.

Platform as a Service (PaaS): In PaaS, the cloud service provider gives flexibility to choose configuration and the user is only responsible for configuration and some troubleshooting options and monitoring options are made available by the cloud service provider.

Software as a Service (SaaS): In SaaS, the complete application is made available by the cloud service provider, where the responsibility of IaaS and PaaS remains with the cloud service provider. The user has to only use it and not worry about provisioning, monitoring, and managing the resources.

Cloud computing has few characteristics defined by NIST, which are noteworthy such as multitenancy, pay-as-you-use (similar to electricity or gas connection), on-demand self-service, resource pooling for better utilization of resources, rapid elasticity for scaling up and scaling down resources based on usage in an automated manner, and measured service for billing.

In the last few years, usage of different cloud deployment models has varied based on use cases and priorities of different organizations. Initially, a public cloud was used for noncritical applications, while a private cloud was utilized for business-critical applications, where security was a major concern. Hybrid cloud usage evolved over time with experiments, experience, and confidence in the services provided by cloud service providers.

As usual in a normal traditional environment for infrastructure management, installation, configuration, and monitoring, it was easier to adopt IaaS as there is complete control. Over time, organizations realized the pain or work behind the management of resources available in the cloud and the cost of managing resources in the cloud as the efforts are the same in managing resources considering security configurations and other configurations.

Hence, PaaS is getting popular day by day with the evolvement of Platform as a Service. PaaS has matured over the years and the scope is much wider and the services allow us to configure different programming languages such as .Net, Java, PHP, Python, and Ruby.

The following is a diagram representing different Cloud Service Models:

In plain English, PaaS provides an infrastructure as well as a runtime environment in combination to deploy an application. The difference is that the end user doesn't have control on the infrastructure while they can configure a runtime environment most of the time. Some service providers allow access to resources created in PaaS but not all. Features such as the ability to debug applications remotely and troubleshoot issues, up to some extent, are also provided. There are PaaS offerings, where you can have dedicated infrastructure resources for application deployment, but even in that case, control of the infrastructure is in the hands of cloud service providers.

Considering the definition of PaaS, everything is managed by the cloud service provider up to the runtime environment. For example, in the case of Java, we don't need to worry about which Java version will be installed and available to update the Java version, the web server version, and so on. Over the years, PaaS has gained its momentum and many organizations have realized that the lower the number of complexities, lesser will be the management overhead. PaaS offerings manage load balancer and high availability with little configuration and hence save lot of time and the architecture is clearer. We need to remember one thing: that most of the control lies with the cloud service provider and hence we do not have much to manage and cloud service providers have more control and they implement all best practices and standard patterns to fulfil the service level agreements (SLAs) attached with PaaS offering.

In short, those who know more about infrastructures and platforms, manage them efficiently, so we have less overhead.

Cloud service providers will handle all resource and version management of all the packages.

However, it means that it is the choice in terms of packages and other options lies with the service provider and not with the cloud consumers. Yes, cloud consumers' choices are considered based on market trends, so indirectly, users have their say in the services offered by the cloud service provider.

In a traditional environment, the infrastructure provisioning process takes place in a different manner than the acquisition of virtual machines in cloud subscription. Additionally, if there are any issues during the steps, then it takes more time in to and fro communication between different stakeholders. Let's visualize how the process workflow is executed in terms of a traditional model or in IaaS and then we will compare it with PaaS:

In the case of PaaS, the flow has fewer complications than the traditional or IaaS process to acquire resources as given as follows:

However, the approval process exists in the cloud environment too as the cost is associated with it and organizations can keep different sets of approval processes to create a virtual machine or to provision any PaaS offering such as email notification.

Having said that, there are many cloud service providers in the market that provide different types of services in an improved and innovative manner. Microsoft Azure is one of the leading cloud service providers available in the market. In the next section, we will explore some important concepts related to Microsoft Cloud to build a base of understanding on which we can kick off with Azure Functions.

Serverless computing

Serverless is not actually serverless. It means that users only need to manage code/application and not servers. The server will be managed by the service provider. We as a user only pay when our code or function is executed in the serverless or in the server that is not managed by us. Scaling is based on the request and pricing differs based on the service provider. AWS Lambda and Azure Functions are two examples of serverless computing or Function as a Service (FaaS). AWS provides a pay-as-you-go billing model, while Microsoft Azure provides a consumption plan as well as an App Service plan for Azure Functions. We will cover this in detail in a comparison table later in the chapter.

Benefits

The following are some of the benefits of serverless computing:

  • Faster time to market as you can write code in the functions editor in the Azure portal and click on Run for execution
  • No need to worry about the infrastructure and provisioning resources
  • Easy bindings to services and external services
  • Create functions in multiple languages as supported by the cloud service provider
  • Pay only for what you use
  • More cost-effective than IaaS and PaaS
  • No configuration is required to set up scaling in and scaling out policies

In the next section, we will cover an overview of the Azure Functions.

Why Azure Functions?

Yes, the immediate question can be what exactly is this Azure Function? In simple English, it is running a function in a cloud environment. It enables us to create a serverless application in a Microsoft Azure environment. Consider a scenario where we know the problem, we know the code that can fix the problem, and we don't want to worry about resources that execute this code. This is the easiest way to focus on logic and business and enhancing the scope of productivity. The biggest benefit is we only need to pay for what we use. Let's understand what exactly in terms of features are provided by the Azure Functions and Azure App Services:

Azure App Services (Web Apps, Mobile Apps), and Functions support different languages and frameworks, DevOps capabilities, scaling, load balancer and etc.

Azure Functions is a service provided by Microsoft for serverless computing. The Azure function is a combination of code plus events plus data. Azure Functions is open source and available on GitHub:

Let's see where Azure Functions is placed in Cloud Service Models in the following figure:

Azure Functions are similar to Azure Webjobs with some differences such as scaling policies, trigger events, and language support. We don't need to worry about infrastructure for execution of the piece of code or function. It is like a FaaS. We can execute Azure Functions in response to events as well.

The languages that are supported are C#, F#, Node.js, Python or PHP, batch, bash, or PowerShell.

There are two types of pricing plans available in the Azure Functions:

  1. Consumption plan: When we execute functions, Microsoft Azure provides all the resources. We don't need to worry about resource management, and we only pay for the time that our functions are executed. The consumption plan pricing includes a monthly free grant of 1 million requests and 400,000 GBs of resource consumption per month. Free grants apply to paid consumption subscriptions only.
  2. App Service plan: This executes functions just the way we execute Azure App Services. We can utilize the same App Service plan created for any application and execute Azure Functions on it without any extra cost.

Having App Service plan as the host for Azure Functions provides lots of benefits that are available with Azure App Services. We can utilize remote debugging, deployment slots, continuous deployment, vertical scaling and horizontal scaling, auto-scaling, and so on. If we use the Azure App Service, then it is a multitenant scenario. If we want to utilize a dedicated environment, then we can utilize the App Service Environment that is a dedicated service from Microsoft Azure, where we can host a function in a virtual network and configure network security groups (NSGs) for an enhanced level of security.

Triggers and bindings are the core of Azure Functions. It allows us to write a function to respond to events that occur in the Azure or other services. As the name suggests, trigger indicates how the function should be invoked and bindings are related to data. Azure Functions can have only one trigger associated with it. Bindings are the connection to the data from within the code available in the function. Unlike triggers, functions can have one or more input and output bindings.

The following table shows the triggers and bindings that are supported with Azure Functions:

Type

Service

Trigger*

Input

Output

Schedule

Azure Functions

Yes

HTTP (REST or Webhook)

Azure Functions

Yes

Yes**

Blob Storage

Azure Storage

Yes

Yes

Yes

Events

Azure Event Hubs

Yes

Yes

Queues

Azure Storage

Yes

Yes

Queues and topics

Azure Service Bus

Yes

Yes

Storage tables

Azure Storage

Yes

Yes

SQL tables

Azure Mobile Apps

Yes

Yes

No-SQL DB

Azure DocumentDB

Yes

Yes

Push Notifications

Azure Notification Hubs

Yes

Twilio SMS Text

Twilio

Yes

SendGrid email

SendGrid

Yes

(* - All triggers have associated input data)
(** - The HTTP output binding requires an HTTP trigger)

Let's try to get to grips with Azure Functions quickly:

  1. Go to https://functions.azure.com/try.
  2. Select Webhook + API as a scenario and select JavaScript as the language.
  3. Click on Create this function:
  4. Select an auth provider.
  1. Select any suitable authentication method and sign in with it:
  2. Wait for few seconds until a free trial fo Azure Functions is ready:
  1. The sample script is ready for Hello World!:
  1. Click on Test on the right side of the browser window. In Request body, provide the name:
  1. Click on Run and scroll down.
  1. See the Output and Status:

So, we have just executed the simple Hello World function. We will execute Azure Functions in a proper Azure subscription in later chapters.

The following are some of the benefits of Azure Functions:

Before we jump to Azure Functions, let's understand some basics of Microsoft Azure cloud. We will discuss the key components and services of Microsoft Azure in the next section.

An overview of Microsoft Azure Services

Microsoft Azure falls into the category of a public cloud deployment model when we consider the definition of cloud computing by the National Institute of Standards and Technology (NIST). Let's first understand the different services of Microsoft Azure and some of the terminology that will be useful later in the book.

Microsoft Azure provides different kinds of services based on different use cases. Let's understand the core concepts to make our foundation robust.

Microsoft Azure comes up with some core concepts that are important to understand before we go ahead and work with it. These core concepts helps us to manage resources and understand the pricing structure as well.

Regions

Microsoft Azure services are available in 34 regions around the globe and they are continuously planning to support more regions. The more regions, the greater the number of customers allowed to achieve better performance with cost optimization. It also helps in the scenarios where data location is legally restricted.

To get the latest details on Microsoft Azure regions, visit https://azure.microsoft.com/en-in/regions/.

To verify Azure Functions available by region, go to https://azure.microsoft.com/en-in/regions/services/ and check the Functions section:

Azure is generally available in 34 regions and 12 Graphic Environment Operating Systems (GEOSs) around the globe. It has already announced plans for 6 additional regions and 2 additional GEOSs. For customers, it is extremely important to have legal compliance in the context of storage location of their data. There are two different possibilities/authorities in this scenario:

  1. Customers may copy, move, or access data from any location
  1. Microsoft may replicate data in other regions of the same GEO for high availability:

Resource groups

Resource groups in Microsoft Azure are logical containers. A resource group is useful for managing resources and providing role-based access to all the resources available in the group easily. It can be used to group all different resources such as App Services, SQL databases, and storage accounts available in Microsoft Azure. We will consider services that we will use in this chapter for most of the examples.

For example, we need to create resources such as Azure Web Apps, SQL database, and a storage account in West US and provide access to some users. It is painful to assign users to individual resources. Rather, it is more manageable if we can provide group access to all the resources.

This way the resources can be managed in a better way.

  1. To create a resource group, go to Azure Portal https://portal.azure.com and click on Resource Groups in the left sidebar menu.
  2. Click on + Add to create a resource group.
  3. Provide the Resource group name, select Subscription, select Resource group location, and then click on Create:
  1. Wait until the resource group is created:
  1. Click on the AzureFunctions resource group:
  1. Once the AzureFunctions</span resource group is created, click on it and verify the Overview section. As of now, there are no resources in the resource group, hence there are No deployments in the Overview section and No resources to display:
  1. To provide role-based access, click on Access control (IAM). Check the OWNER and other details:
  1. Click on + Add and select Contributor role. Find the member whom you want to give access to this resource group:
  1. Select the member and click on Save:

We will use this resource group in the coming chapters as a logical container for different resources such as Azure Functions and storage.

App Services - Microsoft Azure Web Apps

Microsoft Azure App Services is one of the most popular offering from Microsoft Azure. It is a PaaS. There are four kinds of applications created in App services:

Azure App Services is a PaaS offering that has computing resources and runtime environments managed by Microsoft Azure, while the user is only responsible for applications and configurations relating to Web App and High Availability.

The following are some quick points about Azure Web Apps:

  • App Services run on virtual machines - virtual machines are managed by Microsoft Azure
  • There are five pricing tiers that are available - Free, Shared, Basic, Standard, and Premium
  • It supports applications written in Java, ASP.NET, PHP, Node.js, and Python
  • We can integrate Apps with Visual Studio or GitHub
  • We can create Apps from the Azure portal and also from the command line using Powershell commands; hence, it is easier to automate the creation process
  • We can set Continuous Integration and Continuous Delivery or Deployment using Build and Release of Visual Studio Team Services
  • We can configure auto-scaling and make it available across the regions; we can set high availability as well

Let's look at some basic differences between Azure Virtual Machines and Azure Web Apps:

Microsoft Azure Virtual Machines

Microsoft Azure Web Apps

Offering

Infrastructure as a Service

Platform as a Service

Support

Support for Linux, Windows Server, SQL Server, Oracle, IBM, and SAP

Linux and Windows

Categories

General Purpose

Compute Optimized

Memory Optimized

GPU

High Performance Compute

Free

Share

Basic

Standard

Premium

Cost

Per minute billing

Per minute billing

Virtual Infrastructure Responsibility

User

Microsoft Azure

Out of the Box support for VSTS

No

Yes

Management Overhead

Yes

No

Installation and Configuration required?

Yes; the customer is responsible for managing the resources

Web Apps come with a platform that supports different programming languages; we only need to configure the Application settings

App Service plan

An App Service plan (ASP) is a combination of capacities (instance size and instance count on which the application is hosted) and features. Capacity is directly related to cost and hence it is similar to choosing a pricing tier. There are different capabilities and limits available in pricing plans.

Each ASP can be used for different purposes and they provide different features too. There are five pricing tiers as follows:

  • Free: no scaling
  • Shared: no scaling
  • Basic: SLA - 99.95%; maximum instances for scaling - 3
  • Standard: SLA - 99.95%; autoscale, 5 deployment slots; Geo-distributed deployment, VPN hybrid connectivity, deployment slots, and automated backups; maximum instances for scaling - 10
  • Premium: SLA - 99.95%; 20 deployment slots; autoscale, geo-distributed deployment, VPN hybrid connectivity, deployment slots, and automated backups; maximum instances for scaling - 50
App Service or Azure Web App is the main production slot. In the standard and premium tiers, we can create other deployment slots other than the main slot in which we deploy the application. We can use deployment slots for different environments before deploying applications into the main slot. Slots are not different from a live web app. They have their own set of content and configurations and hostnames. We can swap slots to roll back failures too.

The following are some important points regarding an App Service plan:

  • An App Service plan can be shared by multiple applications.
  • Deployment slots are usually deployed on the same App Service plan.
  • Azure Web Apps configured with an App Service plan are changed, and then these changes affect all the applications hosted on the App Service plan.
  • By default, ASP comes with a single instance. If we increase the instance count, then the applications hosted on a single instance will be hosted on other instances too.
  • The number of instances in ASP is directly associated with the price of Azure Web Apps.

Let's create an App Service plan in Microsoft Azure Portal:

  1. Click on More services in the left sidebar and find App Service plans.
  2. Click on + Add.
  3. Provide the App Service plan name, Subscription, Resource Group, Operating System, Location and Pricing tier, and then click on Create:
  1. Click on Notifications to get the progress details of the App Service plan deployment:
  1. Once App Service plan is created successfully, click on the Overview section to get details about it in the Azure Portal:

We can deploy Azure App Services or Azure Functions on App Service plan.

Azure Active Directory

Azure Active Directory (Azure AD) is a cloud based, multitenant, and highly available identity management service from Microsoft:

We can manage users, groups, multifactor authentication, add an application that an organization is developing for authentication, add an application from the gallery for authentication, add a custom domain, role based access control, and so on:

Application Gallery supports more than 2500 applications at the time of writing this chapter:

The categories include business management, collaboration, construction, content management, CRM, data services, developer services, e-commerce, education, ERP, finance, health, human resources, IT infrastructure, mail, marketing, media, mobile device management, productivity, project management, security, social, supply management, telecommunications, travel, and web design and hosting.

App Insights

Application Insights is a flexible analytics service. It helps us to get insights of performance and usage of application. It can be used for .NET or J2EE-based applications that are hosted on-premises or in the cloud. Let's create Application Insights for a sample application:

  1. Create a sample application and go to its Monitoring section. Click on Application Insights. Select Create new resource and click on OK.

 

  1. We can create a Web test for testing application availability from multiple regions. We can select a ping test or a multistep test to check the availability, and alert criteria can also be configured.
  2. Performance Testing is also a very interesting feature available in App Insights. It is more of a load test based on the number of users over a specific duration.
  3. We will see the how to of both in this book, where we intend to cover monitoring.

Azure Services versus AzureFunctions versus AWS Lambda

Let's try to compare Azure App Services, Azure Functions, and AWS Lambda. The following table may not contain all the points:

Azure App Services

Azure Functions

AWS Lambda

Category

Platform as a Service.

Allows you to develop serverless applications on Microsoft Azure.

Allows you to develop serverless applications on AWS.

Definition

Microsoft Azure App Service is a PaaS offering. We can create web and mobile apps for any platform or device.

Azure Functions is a service provided by Microsoft to run small pieces of code, or functions, in the Microsoft Azure cloud. We only need to focus on the problem and not the resources required for the solution.

AWS Lambda allows us to execute code in serverless architecture, where the resources are managed by AWS.

Vendor

Microsoft Azure.

Microsoft Azure.

Amazon/AWS.

Available from

2015.

2016.

2014.

Languages Supported

ASP.NET, Node.js, Java, PHP, and Python.

C#, F#, Node.js, Python, PHP, batch, bash, or any executable.

Node.js (JavaScript), Python, Java (Java 8 compatible), and C# (.NET Core).

Integrated development environment support

Yes (Microsoft Visual Studio IDE).

Yes (Visual Studio).

Yes (Eclipse IDE and Visual Studio IDE).

Environment variables support

Yes, in Application Settings.

Yes.

Yes.

Cost

App Service plan can be hosted are FREE (try for free), SHARED (host basic apps), BASIC (more features for Dev / Test), STANDARD (go live with web and mobile), and PREMIUM (enterprise scale and integration).

For more details go to https://azure.microsoft.com/en-in/pricing/details/app-service/.

Consumption plan means that when we execute functions, Microsoft Azure provides all the resources. We don't need to worry about resource management, and we only pay for the time that our function runs.

For more details go to https://azure.microsoft.com/en-in/pricing/details/functions/.

The Lambda free tier includes 1M free requests per month and 400,000 GB-seconds of compute time per month.

The first 1 million requests per month are free and $0.20 per 1 million requests thereafter ($0.0000002 per request).

For more details go to https://aws.amazon.com/lambda/pricing/.

Eligible for free tier

Yes.

Yes.

Yes.

Flexibility in configuration of resources

Yes.

Limited. (If App Service plan is used then configuration of resources is available.)

No (need to verify).

Execution time

N/A.

Azure Function must complete execution within 300 seconds.

AWS Lambda function must complete execution within 300 seconds.

Limit to the number of functions that can be executed

N/A.

No.

No.

Concurrent executions

N/A.

No limit.

By default, AWS Lambda limits the total concurrent executions across all functions within a given region to 1000.

Scalability

Manual and automatic scaling available in the form of an App Service plan.

Manual and automatic scaling has two plans available for costing; a Consumption plan and an App Service plan. For more details, check the Cost section in this comparison table.

Automatic scaling.

Monitoring

Azure App Insights / Azure App Service Default Monitoring.

N/A

Amazon CloudWatch console or AWS Lambda console.

Templates

Web

Web + SQL

Web Apps

Mobile Apps

Logic Apps

Media services

Blogs + CMSs

Starter web apps

Web app frameworks

Ecommerce

Add-ons

BlobTrigger

EventHubTrigger

Generic Webhook

GitHub Webhook

HTTPTrigger

QueueTrigger

ServiceBusQueueTrigger

ServiceBusTopicTrigger

TimerTrigger

Blank function

kinesis-firehose-syslog-to-json

alexa-skill-kit-sdk-factskill

batch-get-job-python27

kinesis-firehose-apachelog-to-json

cloudfront-modify-response-heade

s3-get-object-python

config-rule-change-triggered

lex-book-trip-python

Supported event sources /integrations

N/A.

Azure Cosmos DB

Azure Event Hubs

Azure Mobile Apps (tables)

Azure Notification Hubs

Azure Service Bus (queues and topics)

Azure Storage (blob, queues, and tables)

GitHub (Webhooks)

On-premises (using Service Bus)

Twilio (SMS messages)

Amazon S3

Amazon DynamoDB

Amazon Kinesis Streams

Amazon Simple Notification Service

Amazon Simple Email Service

Amazon Cognito

AWS CloudFormation

Amazon CloudWatch Logs

Amazon CloudWatch Events

AWS CodeCommit

Scheduled Events (powered by Amazon CloudWatch Events)

AWS Config

Amazon Alexa

Amazon Lex

Amazon API Gateway

Other Event Sources: Invoking a Lambda Function On Demand

Sample Events Published by Event Sources

URL

https://azure.microsoft.com/en-us/services/app-service/

https://azure.microsoft.com/en-us/services/functions/

https://aws.amazon.com/lambda/

Documentation

https://docs.microsoft.com/en-us/azure/app-service/

https://docs.microsoft.com/en-us/azure/azure-functions/

https://aws.amazon.com/documentation/lambda/

Summary

So finally, we are at the end of the first chapter of this book.

In this chapter, we have discussed serverless architecture with the evolution of cloud computing. We covered the definition of cloud computing, cloud service models, cloud deployment models, and so on.

We discussed in detail about IaaS and PaaS and how they have matured and how the use cases have changed and why. We touched upon serverless computing and its visible benefits as an evolution.

We also discussed in detail Azure Function, saw an overview of how the function is executed in a free trial, and got a basic understanding of the Microsoft Azure platform.

In the last section of this chapter, we covered some of the differences between Web App AWS Lambda and Azure Functions.

In the next chapter, we will discuss Azure Functions, its architecture, and other details and we will create our first function in the Microsoft Azure subscription.

 

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Learn to develop, manage, deploy, and monitor Azure functions in any language.
  • Make the most out of Azure functions to build scalable systems.
  • A step-by-step guide that will help you eliminate the pain points of implementing a serverless architecture.

Description

Functions help you easily run small pieces of code in cloud with Azure functions without worrying about a whole application or the infrastructure to run it. With Azure functions, you can use triggers to execute your code and bindings to simplify the input and output of your code. This book will start with the basics of Azure Functions. You will learn the steps to set up the environment and the tools that we will be using in the further chapters. Once you have a better understanding of this, we will be creating our first hello world function app. Later you will be introduced to triggers, how they are used to activate a function, and how binding can be used to output results of a function.You will also explore the steps to create an assembly with complex functionality that can be used by functions. Next, this book will teach you to scale your functions and use them to process data, integrate systems, and build simple APIs and microservices. Finally, this book will cover some diagnostic techniques with Azure App services and best practices of working with Azure Functions. By the end of this book, you will be well-versed with the techniques of scaling your Azure functions and making the most of serverless architecture.

Who is this book for?

This book aims at IT architects and developers who want to build scalable systems and deploy serverless applications with Azure functions. No prior knowledge of Azure functions is necessary.

What you will learn

  • Understand the folder structure of a function and the purposes of the files
  • Deploy a function and test it
  • Explore the common triggers that are used to activate a function
  • Discover how bindings can be used to output the results of a function
  • Build a dll that has functionality that can be leveraged by a function
  • Chain functions to allow the invocation of one function from another
  • Understand how to monitor the health of your functions
Estimated delivery fee Deliver to Thailand

Standard delivery 10 - 13 business days

$8.95

Premium delivery 5 - 8 business days

$45.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Sep 28, 2017
Length: 240 pages
Edition : 1st
Language : English
ISBN-13 : 9781787122932
Vendor :
Microsoft
Languages :
Concepts :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Thailand

Standard delivery 10 - 13 business days

$8.95

Premium delivery 5 - 8 business days

$45.95
(Includes tracking information)

Product Details

Publication date : Sep 28, 2017
Length: 240 pages
Edition : 1st
Language : English
ISBN-13 : 9781787122932
Vendor :
Microsoft
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 141.97
Learning Azure Functions
$43.99
Azure for Architects
$48.99
Azure Serverless Computing Cookbook
$48.99
Total $ 141.97 Stars icon
Banner background image

Table of Contents

9 Chapters
Introducing Microsoft Azure Services and Functions Chevron down icon Chevron up icon
First Function App - Anatomy and Structure of a Function App Chevron down icon Chevron up icon
Application of Triggers Chevron down icon Chevron up icon
Bindings Chevron down icon Chevron up icon
Webhooks for Azure Functions Chevron down icon Chevron up icon
The Real World - Functions to Build Consumable APIs Chevron down icon Chevron up icon
Managing and Deploying your Code Chevron down icon Chevron up icon
Business Considerations Chevron down icon Chevron up icon
Working with Different Languages Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
(3 Ratings)
5 star 0%
4 star 33.3%
3 star 33.3%
2 star 33.3%
1 star 0%
Ashish Bhatia Jan 06, 2018
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Good Read for learning Azure functions
Amazon Verified review Amazon
YC Oct 14, 2017
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
Only a little more information than what Microsoft provides to you in their free tutorials.
Amazon Verified review Amazon
Jared Rich Jan 19, 2018
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
This book clearly wasn't edited before being published. The information is OK, but the broken English is difficult to decipher sometimes and many examples are missing crucial steps.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela