From the course: Azure Functions for Developers
Creating Azure Functions using the Core Tools - Azure Tutorial
From the course: Azure Functions for Developers
Creating Azure Functions using the Core Tools
- [Instructor] In this video, I'm going to show you how to create Azure Functions using the Azure Function Core Tools. While I used Visual Studio for this course, I think it's beneficial to understand the underlying processes, as Visual Studio uses the Azure functions Core Tools to generate these projects. Okay, so if you want to follow along, be sure to have the Azure Functions Core Tools folder in your path, so you can call func, and then something like version, and it has to respond with the current version that you're running. Okay, so now, the following command is going to create the required files for an Azure Functions project. This is func init. So, this is interactive. I have to select the worker runtime that I want. In this case, isolated worker model, and then C#. After some seconds, all the required files will be created. So, you can see that we have host.json, Local.settings, the csproj file, and of course, the Program.cs file. Let's see the contents of Program.cs. So, we can see that this is a regular .NET application. Okay, so now, let's execute another command for creating Azure Functions, not only the project, and the command is func new. So here, I need to decide what kind of trigger I want for my function. In this case, I'm going to use HttpTrigger, and let's name the function as MyFunction. So, the function was created, and let's see the contents. MyFunction.cs. We can see that this is just a regular C# class, and it's using the HttpTrigger, and it's responding, "Welcome to Azure Functions!" Okay, perfect. Now, I need to test this out. So, let's execute yet another command, which is func start, and this is going to build the project, and then it's going to run the host runtime, and it's going to load all the different functions that I have. Of course, I only have one function, which is my function, and it's ready to receive requests. So, let's copy this, let's open another PowerShell tab and say curl. It's going to send this URL, and as expected, this is returning, Welcome to Azure Functions!