Previous incarnations of Azure Functions used C# script files. With the latest release, you can develop Azure Functions that use standard C# class files. This means you can use all your prior .NET knowledge to easily create Azure Functions whilst utilizing the powerful development environment that is Visual Studio. In this course, Writing and Testing Precompiled Azure Functions in Visual Studio 2017, you will learn how to set up your local development environment to develop and test Azure Functions locally. You will then learn how to create Azure Functions that are triggered from incoming HTTP requests. In addition, you will learn about integrating with Azure Storage queues and blobs, Azure Service Bus, and Azure Event Hubs. By the end of this course, you will be able to create an Azure Functions project from scratch in Visual Studio, write and debug functions locally, create unit tests, and publish your finished Azure Functions App to the cloud.
Course Overview Hi everyone. My name's Jason Roberts. Welcome to my course, Writing and Testing Precompiled Azure Functions in Visual Studio 2017. I'm a Microsoft MVP, freelance developer, and author. In this course, we're going to learn how to get started creating serverless applications with Azure Functions right from inside Visual Studio. Some of the major topics that we'll cover in this course include how to set up a new Functions project, how to respond to events such as HTTP requests or new message queue items, how to test functions locally on your development machine, and how to publish functions to the cloud. By the end of this course, you'll understand how to create Azure Functions that integrate with other cloud services, test and debug functions locally, and deploy functions to Azure or from within the familiar Visual Studio environment. Before beginning the course, it's recommended that you have at least a basic understanding of C#. I hope you'll join me on this journey with the Writing and Testing Precompiled Azure Functions in Visual Studio 2017 course, at Pluralsight.
Creating a Function Locally and Publishing to Azure Hi, welcome back. In the previous module, we learned some of the reasons why we might want to use Azure Functions, we looked at setting up our development environment, and then we created a new, empty Azure Functions project in Visual Studio. In this module, we're going to create our first Azure Function, and using Visual Studio, publish it to the cloud. So in this module, we're going to start off by getting a brief overview of the Azure Function development process in Visual Studio, and then we'll learn a bit more about HTTP triggers and how we can configure them with attributes. We'll get an overview of the demo solution that we're going to be building in this course, and then we'll go and add our first function to our project. In this module, this function will be triggered by an HTTP request. Once we've created the function, we'll see how we can execute it locally using the local Azure Functions runtime. We'll see how we can create breakpoints during debugging, just like any other. NET code. Once we've debugged the function locally, we'll learn how we can use Visual Studio to publish this function up to the cloud. During this module, we'll also learn about the Postman app, and this is an extremely useful app to test HTTP endpoints. We'll also learn how we can attach the debugger in Visual Studio to a function that we've published to Azure. So let's kick off this module by getting a brief overview of Azure Function development in Visual Studio.
Configuring Precompiled Functions to Work with Azure Storage Hi, welcome back. In the previous module, we went and created our first Azure function in Visual Studio, and we published it to the cloud. We created a function triggered by an incoming HTTP request. In this module, we're going to learn how we can integrate our functions with Azure Storage. So we're going to kick off this module with a brief overview of what Azure Storage ism and some of the features it offers. We'll get an introduction to the Azure Storage Emulator that allows us to test our functions locally without needing an internet connection. We'll then get an overview of some of the attributes involved when we're configuring triggers and bindings for Azure Storage, including configuring blob storage attributes, queue storage attributes, and also table storage attributes. We'll then go and modify the function that we created in the previous module to add an Azure Queue storage output binding so when the HTTP function receives a loan-application, it's going to write this loan-application to an Azure Queue for another function to pick up. Once we've done this, we'll see how we can test locally using the Azure Storage Emulator, and we'll see the loan-application written to a queue on our local machine. Because of some of the limitations of the Azure Storage Emulator, we may actually want to use a real Azure Storage account in the cloud, so we'll see how we can set up our local development environment to use an Azure Storage account in the cloud, rather than using the local storage emulator. We'll finish up this module by creating some new functions, functions that are triggered by messages being written to an Azure Queue, and also functions that are triggered when new blobs are written to blob storage. So let's kick off this module by getting a brief overview of Azure Storage.
Working with Other Triggers and Azure Services Hi, welcome back. In the previous module, we learned how we can integrate our Azure functions with Azure Storage. So we learned how we can output to Azure queues and blobs, and also how we can create functions that are triggered by new blobs and new queue messages. In this module, we're going to be looking at some of the other Azure services, and learning how we can integrate our functions with these services. We won't be covering every single Azure service that we can integrate with from our functions, and in this module we're going to learn how we can add a new function that's triggered by a new Azure Service Bus message. And we're also going to learn how we can create a function that's triggered by Azure Event Hub messages. We'll learn how we can send test messages to both Azure Service Bus and Azure Event Hub, and we'll go and publish our new functions to the cloud. We'll learn how we can add custom application settings to our published Azure function app. So we'll see how we can add a default Service Bus connection, and also make use of named Event Hub connections. Finally, we'll round off the module by learning how we can create an Azure function that automatically executes periodically on a specified schedule. And as part of this, we'll learn a bit more about CRON expressions, which allow us to specify how often the function executes. So let's kick off this module by heading back to the Azure portal, and we'll go and create a new Service Bus.
Writing and Running Azure Function Unit Tests in Visual Studio Hi, welcome back to this final module. One of the benefits of creating precompiled Azure Functions over the previous incarnation of functions that just used CSX script files, is that we can bring to bear all of the familiar tools and techniques that we use for regular. NET code. This includes the ability to write and execute unit tests as part of the development process. So in this module we're going to be learning how to reuse business logic from within an Azure Function app. To do this, we're going to extract out the business logic and create unit tests for it. So we'll head over to Visual Studio, and we'll add a new unit test project to our solution, and I'll also add a new class library project. We'll then start to refactor the ScoreApplication function to extract the business logic. First off, we'll move the LoanApplication class to our new class library project. We'll add a new LoanScorer class to our class library project, and this LoanScorer will contain our business logic. We'll then modify the ScoreApplication function body to make use of our new LoanScorer class. Because we've extracted out the business logic into this shared LoanScorer class, we can go and write unit tests for it. And once our unit tests pass, we'll go and publish the final solution to Azure. We'll then go and send both accepted and declined requests, and see the final solution in action.