How to create an Azure Function in Visual Studio

These are some good instructions as well “Create your first function using Visual Studio”.  But I like to try it out myself.  Check out these other articles as well.

First, open Visual Studio and create the Azure Function, similar to that shown in Figure 1.

image

Figure 1, how to create an Azure Function using Visual Studio

Select the trigger type, I chose the below configuration, I.e. Http Trigger as seen in Figure 2.

image

Figure 2, how to create an Azure Function using Visual Studio

Without making any changes, I pressed F5 and was then asked to install the Azure Functions CLI tools, Figure 3 and I did that.

image

Figure 3, how to create an Azure Function using Visual Studio

The simulator started up, as seen in Figure 4.

image

Figure 4, how to create an Azure Function using Visual Studio

Once the CLI tools were installed, the CMD window, seen in Figure 5 opened up and provided me the URL to test the Azure Function.

image

Figure 5, how to test local an Azure Function using Visual Studio

Then I used CURL from another CMD window to call and test the Azure Function, see Figure 6.

image

Figure 6, how to test local an Azure Function using Visual Studio

That was too easy, Azure Functions are pretty cool.

Be sure to check out my other Azure Function articles here.

After I published my Function, I had some problems:

I resolved them, but the thing is that when I access the Function in the portal I have limited means of updating there in the portal itself.  This if fine, since I decided to create from Visual Studio, I will need to develop, test and publish in Visual Studio from this point on.  Do not think that you can go back and forth between developing in the portal and in Visual Studio.  It is either or and you need to decide how you want to develop.  When created from this direction, I see this, Figure 7 in the portal when I navigate to it.

image

Figure 7, how to test local an Azure Function using Visual Studio, azure portal

You can consider creating the Azure Function App and Function, then downloading the project and doing some developing and testing in Visual Studio, then cut & paste the changes from Visual Studio into the Azure Function IDE in the portal.