Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Robust Cloud Integration with Azure

You're reading from  Robust Cloud Integration with Azure

Product type Book
Published in Mar 2017
Publisher Packt
ISBN-13 9781786465573
Pages 696 pages
Edition 1st Edition
Languages
Authors (6):
Gyanendra Kumar Gautam Gyanendra Kumar Gautam
Ashish Bhambhani Ashish Bhambhani
Profile icon Ashish Bhambhani
Abhishek Kumar Abhishek Kumar
Profile icon Abhishek Kumar
James Corbould James Corbould
Profile icon James Corbould
Mahindra Morar Mahindra Morar
Profile icon Mahindra Morar
Martin Abbott Martin Abbott
Profile icon Martin Abbott
View More author details

Table of Contents (23) Chapters

Robust Cloud Integration with Azure
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface
1. An Introduction to Systems Integration in the Cloud 2. What Is an Azure App Service? 3. Getting Started with API Apps 4. What is Azure API Management? 5. Trigger Your First Logic App in Azure 6. Working with Connectors in Logic Apps 7. Azure Functions in Logic Apps 8. A Deep Dive into Logic Apps 9. Powerful Integration with SaaS Using Logic Apps 10. Advanced Integration with Powerful, Scalable Service Bus in the Cloud 11. Connecting to Event Hubs and an Introduction to IoT Hubs 12. EAI/B2B Integration Using Logic Apps 13. Hybrid Integration Using BizTalk Server 2016 and Logic Apps 14. Tooling and Monitoring for Logic Apps 15. Whats Next for Azure Integration?

Chapter 7. Azure Functions in Logic Apps

Azure Functions were introduced during Microsoft Build 2016 as a means to provide a serverless computing environment that could scale as needed and provide a pay-as-you-go service. Serverless computing is a means of providing computing power and resources for solutions without the need to be concerned about the underlying infrastructure.

They provide a mechanism that allows developers and solution architects to react to events and process usually small amounts of functionality before either passing back a response or creating another event.

Given this, Azure Functions provide a mechanism to deliver a truly event-driven architecture, including the ability to chain and fan out events to multiple sources.

In the previous chapters, we have spoken about how Logic Apps and the App Service model within Microsoft Azure provide a good basis to build solutions that follow microservices architectural principles.

One of the key requirements for a microservices architecture...

The basics of Azure Functions


Azure Functions are essentially a managed service for WebJobs SDK that provide similar functionality but in a fully serverless environment.

WebJobs provide a means to run background tasks in the context of a Web App, Mobile App, or API App. With them, you can upload a script such as PowerShell or a command file and have them run on a schedule (https://azure.microsoft.com/en-us/documentation/articles/websites-webjobs-resources/).

At the very basic level, Azure Functions can be thought to be defined by:

Events + Code + Data = Function App 

The key part of a Function App is the initial trigger that starts the process of running the code contained within a function. This trigger can be in the form of an input event, such as a message being written to a queue, or a timed event. A function can have a number of outputs that send data and information to a range of endpoints.

A Function App represents a unit of computing, and it can contain a number of functions, each...

Building Azure Functions


Azure Functions are created in the main Azure portal in a Resource Group in the same way as other resources.

When creating a Function App, the App Service plan needs to be selected. This can be either Classic, which allows the creation of a new App Service Plan or reuse of an old one, or Consumption based to use pay-as-you-go and on demand processing.

The Function App takes a few minutes to be created, but once created, functions can be added to perform the tasks required.

The Function App has a number of settings that can be used to configure it once it has been created.

The settings page provides options for setting a daily usage quota for the Function App, accessing development resources including app settings such as connection strings, setting up Continuous Integration, configuring Authentication/Authorization and cross-origin resource sharing and providing a link to a URL that contains the Swagger API definition for a Function App that contains HTTP triggers...

Using functions with Logic Apps


Up to this point, we have been discussing how to create and use functions within a Function App for general use cases when serverless computation is required or when we wish to create an event-driven solution.

Functions can also be called directly from a Logic App. While it is possible to use the event-driven nature of functions to create a highly decoupled and scalable solution, using functions directly called within a Logic App provides a mechanism to add simple business logic that cannot be achieved through the standard functionality available within Logic Apps.

This introduces the Logic Apps equivalent of lambda expressions, which are essentially anonymous functions that are invoked only when required (https://msdn.microsoft.com/en-us/library/bb397687.aspx).

Calling functions directly

How to create a Logic App has been discussed previously, so for the purpose of this scenario, we will assume that one has already been created using the Blank Logic App template...

Other considerations


Deploying your Function App

Function Apps are stored using a basic file structure, as shown previously. Given this, they can be deployed through mechanisms that support a file structure in a similar way to Web Apps, including the use of continuous integration and continuous deployment.

Deployment options are available in the App Service settings.

Deployment credentials allows the setting of the username and password for deployment via FTP or Git. The FTP endpoint for the Function App can be found in Properties of the App Service.

Deployment options provides access in order to set up deployment from a number of sources.

For example, to set up Github as the deployment source, we would choose GitHub from the list. For most of the sources, we need to authorize access to the specific account. Once this has been provided, the source can be configured.

If Visual Studio Team Services is chosen as the deployment, it is not necessary to authorize access if the instance of Visual...

Summary


In this chapter, we showed the capabilities of Azure Functions. We discussed the basics and structure of Function Apps.

We gave some examples of functions, how they can be used to trigger events, and how they can be integrated with each other to create a chain of events that can also fan out.

Azure Functions can be used directly within Logic Apps and can act as anonymous units of code in a similar way to lambda expressions. Functions within Logic Apps can be used to provide business logic and can additionally be used to trigger other events during the execution of the Logic App.

We created a sample scenario to check the information in an invoice as an example of how to call a function within a Logic App.

Finally, we showed other important parts of Azure Functions that can be used to deploy, monitor, and scale them, and how to disable and delete them.

Azure Functions are a good platform service to use if you need scale on demand and serverless computing power. They are a good solution...

lock icon The rest of the chapter is locked
You have been reading a chapter from
Robust Cloud Integration with Azure
Published in: Mar 2017 Publisher: Packt ISBN-13: 9781786465573
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}