#Azure #AzureFunction #AzureAppService
I also found some good instructions on how to test Azure Functions here.
As shown in Figure 1, I created a C# Http Trigger Azure Function named ‘SayHello’ with an Authentication level of Anonymous.
Figure 1, testing an Azure Function in Visual Studio
Here is some information about the different Authentication levels which control whether you are using an API key and which key to use.
|Function||Uses your function key|
|Anonymous||No key required, use the code|
|Admin||Uses your master key|
If you hover over the ‘i’ button shown in Figure 1, it also states that “The function and master key are found in your host secrets file. For user-based authentication, go to Functions App Settings”. The Function App Setting are accessible in the Azure Management Portal.
After select the Create button shown in Figure 1, I ran the Azure Function right in Visual Studio by pressing the
Notice in Figure 2, after starting the Azure Function in Visual Studio that it states “No ‘Id’ property defined in host.json. Updating host.json with a new ‘id’”
Figure 2, running an Azure Function in Visual Studio
This id is required via a parameter as part of the URL used in Figure 3 to test the Azure Function. Notice that it shows the URL to call for testing the Azure Function.
In Figure 3, I use CURL to call the Azure Function.
Figure 3, testing an Azure Function in Visual Studio using CURL
Then I deploy it out to an Azure App Service Web App and I can consume it in the same method, using the Azure App Service Web App URL instead of the local host, Figure 4.
Figure 4, testing an Azure Function on Azure using CURL
I know the code is different, ignore that, it does remain the same after deployment.