Let's create a JavaScript function in Microsoft Azure using Azure Portal:
- Log in to the Azure portal and navigate to the function app, which we created in the previous chapter.
- Click on the + sign to add a new Azure Function. Set the language as Javascript and the template as Generic Webhook, as shown in the following screenshot:
![](https://static.packt-cdn.com/products/9781787122932/graphics/assets/7d69bcb9-1eb8-4aa5-9785-f38f554c53df.png)
- Now provide a name for the function and click on Create:
![](https://static.packt-cdn.com/products/9781787122932/graphics/assets/30e315fe-3fbf-4da4-8c88-a3580f44de77.png)
- A default template will be created, as shown in the following screenshot:
![](https://static.packt-cdn.com/products/9781787122932/graphics/assets/0c2c8d32-043b-4c15-977d-6fac156964c4.png)
- Get the function URL and copy it. We will use it later in the chapter. Save it in a notepad:
![](https://static.packt-cdn.com/products/9781787122932/graphics/assets/4308d27b-2d67-447b-8910-d0f87d8a9c5e.png)
- Now, we will create a Webhook endpoint in an activity log alert in Azure Monitor. Click on Monitor, as shown in the following screenshot:
![](https://static.packt-cdn.com/products/9781787122932/graphics/assets/86f75df8-5ed2-44c6-b36d-0519dfab2c63.png)
- Now we need to create an alert. Click on Alerts and then on Add activity log alert:
![](https://static.packt-cdn.com/products/9781787122932/graphics/assets/47359eab-7121-499c-938f-e65efa9dd852.png)
- Provide the following details:
![](https://static.packt-cdn.com/products/9781787122932/graphics/assets/2759a5c8-6d06-4c88-8217-62466bd610fa.png)