ASP.NET Core WebHooks - Running the AzureAlertWebHook

In the previous post I wrote about how to get and build the ASP.NET Core Webhooks repository. In this post I'm going to investigate how to test one of the webhooks locally. For this I am going to start with investigating the AzureAlertWebHook. Why choose this one? It is relatively straight forward and should require minimal setup.

After getting the latest code and making sure it builds (see previous post) it is time to run it in Visual Studio to allow for debugging. There are 3 main parts to the solution:

Src - This is where all the projects for the nuget packages are kept

Test - This is where the test projects are for each individual webhook

Samples - This is where there are sample ASP.NET Core web applications for each of the webhooks

Open up the Samples folder and set the AzureAlertCoreReceiver project as the start up project. On first run I got an error:

This means that we've have not setup out security secrets correctly for this webhook to function.

How to setup the secrets

To setup your secrets you need to right click on the web projects and select "Manager User Secrets". You should never add secrets for application configuration files which are commited to source control.

Debugging Locally

You should now be able to add a break point into the Controller action AzureAlert and be able to see what the values are of the model values being passed into the Controller action when submitted through the rest client.

Conclusion

In this blog post I have showed how to get the sample AzureAlertWebHook project running locally, setup the security secrets for the webhook to allow for the code to be executed and debugged locally using a rest client.

Any questions/comments then please contact me on Twitter @WestDiscGolf