1. Home
  2. Training Library
  3. Microsoft Azure
  4. Courses
  5. Configuring Serverless Computing on Azure

Create a Function in the Azure Portal

The course is part of these learning paths

AZ-101 Exam Preparation: Microsoft Azure Integration and Security
course-steps 11 certification 4 lab-steps 5
play-arrow
Start course
Overview
DifficultyBeginner
Duration1h 20m
Students229

Description

Course Overview

Learn Configuring Serverless Computing on Azure with this course. Allowing cloud engineers to leverage serverless technologies to deploy solutions is vital to any enterprise. In this course you will learn to do this without the hassle of maintaining actual servers or virtual machines. In addition, this course provides a true insight into the creation of a 'Function App'. This is an interesting feature because creating a basic Function App is actually deceptively easy. Develop your skills with this course by learning exactly how to create a basic Function App. 

We would recommend having an intermediate understanding of MS Azure along with knowledge of its principles and product offerings before starting, ensuring that you yield the maximum potential of the training content. This Azure training content is made up of 11 comprehensive lectures along with an overview and summary.

This course can also be found in the following Learning Paths:

Learning Objectives

  • Learn what serverless computing is and what it offers
  • You’ll learn how to create an Azure Function in the Azure Portal and how to manage Azure Function App settings
  • Learn how to create an automated workflow with Azure Logic Apps
  • Learn about Event Grid and how to use it to monitor for changes in an Azure subscription
  • Learn what Azure Service Bus is and how to use it

Intended Audience

  • IT professionals who are interested in earning Azure certification
  • IT professionals who need to deploy and configure serverless resources in Azure

Prerequisites

  • Access to an Azure tenant to follow along with demos
  • Moderate understanding of Azure

Related Training Content

Transcript

So we've established in our previous lesson that Azure functions allow you to execute code in a serverless environment without needing to create virtual machines or publish web applications. In this demonstration, we're going to use Azure functions to create a hello world function in the Azure portal. To get started we simply have to log in to our Azure portal, which I've done here. On your screen, you can see that I have a dashboard setup here for serverless computing. What I'm going to do here is create a function app that's going to host the execution of our function. To create our function app, we simply click create a resource, and then we select the compute section under Azure Marketplace. If we scroll down here, we can see function app is listed as one of the more common selections. You could also just search for function app in the search bar as well. So we'll select function app here, and what happens here is we're going to be prompted for some information. First and foremost we need to give our function app a name. Now if you look closely here, the name that we give our function app is going to append this domain name, the azurewebsites.net. So what this is telling me right out of the gate is that my name for my function app needs to be unique across the entire Azure Landscape. So what I'm going to do here is give my app a name, and I'll call it TestApp9878 to match my Test10 in here. Of course, we have to select a subscription to deploy our function app too, and we're going to deploy to the pay as you go subscription. We also have an option here to create a new resource group or use an existing resource group to deploy our resource too. 

So I'm going to create a resource group, I'm gonna call it function app. For this demonstration, we're going to use the Windows OS, and we'll use the consumption plan. You actually have two different options here, the consumption plan and a service plan that we talked about earlier. The consumption plan is the default option. And what this is going to do is add resources dynamically as our functions require them. And we're only going to have to pay for the time when our function is running. Obviously, I'm trying to save a couple of dollars here, this is a lab environment, so the consumption plan works for me here. The location can be essentially anywhere, I typically put my resources in East US, and our run time stack here can be any one of .Net, JavaScript, or Java preview. We're going to use .Net for this demonstration. And we're going to need to create a storage account for our function app. So I'll just keep the default naming convention here that's chosen for me. And you can see here application insights is already selected for me, if I choose application insights, it's enabled automatically. So we'll go ahead and apply this, and go back to our function app creation screen here. After supplying this information for my function app, I can click create to deploy the actual function app itself. What we're going to see here is a deployment in progress notification. And then once it succeeds we're going to pin this to our dashboards so we can access it more readily later on. So now that it succeeded we'll pin it to our dashboard here. Now before I go any further what I'm going to do is pin my resource group to my dashboard as well. So here's our function app resource group, so I'll go ahead and pin him to the dashboard. 

So let me move this new resource group pin over to my other side of the screen here where we can see. And we'll finish customizing. So now we have all the resources for this demonstration accessible right from our dashboard here. Now that we have our function app deployed and running, we can create what's called an HTTP Trigger function. To do this we expand our function app here, and then we can click on the plus sign here for functions. We're going to create a new function within the function app. We're going to have a couple of different options here, we're going to have an option to use Visual Studio, Any editor and Core Tools, VS Code, or In-portal. We're going to create our function In-portal. So we can click continue here. Now because our function is going to run when it receives an HTTP request, we're going to select the Webhook plus API option, and then click create. After the function is created the code for the function is displayed on our screen. What we can do here is save it, and then what we wanna do is test our function. To test our function we click on the get function URL link here. And we're going to see here is a long URL here, that points to our function app. We'll copy this URL here, and open up an incognito browser. And launch our app, so you can see here, just launching the URL prompts us with a response that we need to pass a name on the query string for it to function properly.

 So let's try it again with a query string. And then we'll run it again. And as you can see here, the function app responds with a Hello, Tom response. That includes the name that I provided in the query string. Now when this function runs, there is trace information that's written into logs. We can look at the trace output for this function by bouncing back over to our function app here, and then expanding logs down at the bottom. And you can see here, the function was triggered twice. The first time I triggered it was without my query string, and the second time was with the query string. So creating a basic function app took all of a few minutes. And I didn't need to deploy a VM, I didn't need to deploy a full web app, none of that stuff was required. I simply went right into the dashboard, right into the portal, created a function app, and then created a function within that function app that included an HTTP Trigger, and I was able to produce a basic function that responds to HTTP input.

About the Author

Students2115
Courses10

Tom is a 25+ year veteran of the IT industry, having worked in environments as large as 40k seats and as small as 50 seats. Throughout the course of a long an interesting career, he has built an in-depth skillset that spans numerous IT disciplines. Tom has designed and architected small, large, and global IT solutions.

In addition to the Cloud Platform and Infrastructure MCSE certification, Tom also carries several other Microsoft certifications. His ability to see things from a strategic perspective allows Tom to architect solutions that closely align with business needs.

In his spare time, Tom enjoys camping, fishing, and playing poker.