The first article of this series, Introduced what Azure Functions are and the capabilities they offer when used by themselves or combined with other Azure resources. This article will focus on getting started with just one of the types of Azure Functions available…the HttpTrigger function.
Creating the Azure Function
You can quickly get started with creating an Azure Function by going to the Azure Functions Get Started Portal. After logging in you will be taken to the Azure Functions getting started portal as shown below.
Using the above Getting Started portal, enter the name and location of your Azure Function app, in my case I’m using a name of GettingStartedAzureFunction and a location of East US.
Then then click on Create + get started button. This will then take you to the Azure portal inside your Azure Function app. From here you can get started quickly with a premade function, in my case I went with Webhook + API, and C# for the language. Finally click on the Create the function button to create this function.
A new function named HttpTriggerCSharp1 will be generated for you, which will be based on C# and this function will be run whenever it receives an HTTP request.
At this point your function is ready to go. You can see the Function URL at the top and below is the generated code for the Http trigger.
Testing your Function
Since this function is generated from the quick starts, it already contains functional code which you can immediately run and test.
In this example you can quickly test the function by clicking on the Run button at the bottom of the page. It will pass a request body with the named parameter of “Azure” to the function, which will then show up in the Output pane to the right.
Alternatively you can also test the function by browsing to the URL to trigger the function. In this case I’ll navigate to the URL provided and the pass in the parameter name of “callon” to the query string like so.
Monitoring your Function
Now that your function is up and running you can easily monitor it by going to the Monitor tab of your function. From here you can see recent success and error counts and inspect the function requests.
Managing your Functions
After creating your Azure Function app, you will be taken to your Azure Function app blade where you can create and manage your functions. If you need to get back to your Azure Function apps at a later time, you can navigate to the App Services blade and then filter by function as shown here.
Next Steps
Now that you have your Azure Function you will most likely want to integrate it into other Azure resources or other apps. If you click on the Integrate tab of the function, you can quickly define an integration (triggers, inputs and outputs) and there is also an advanced editor available if needed.
Lastly if you scroll down on the Integrate tab, you will come to some handy documentation.
In a future post I will walk through integrating an Azure function with another Azure resource.
Enjoy!
References
Azure Functions
Azure Functions Documentation
Testing Azure Functions