Monitoring Azure App Service

When it comes to PaaS, one of the most popular services from Azure is Azure App Service, also known as Web Apps. They allow you to quickly get started with a server for hosting your web applications, which can be easily configured and adjusted to your needs. Besides purely development experience, Azure App Service also includes a set of features that make monitoring and diagnosis a piece of cake. In this section, I will show you how to monitor your web application and find the root cause of issues you may face.

To get started, we will need an instance of a Web App in Azure. You can deploy it really quickly using the Azure CLI:

$ az appservice plan create -g <rg-name> -n "<plan-name>" --sku <sku>
$ az webapp create -g <rg-name> -n "<webapp-name>" -p "<plan-name>"

To create an instance of Azure App Service, you need two commands:

  • The first one will create an Azure App Service Plan that gives you resources (CPU, memory, and storage) that can be used by your applications.
  • The second one creates the actual Web App, which will host the files of your application.
Remember that you can attach multiple Web Apps to a single App Service Plan.

Once your Web App has been created, we can focus on implementing various monitoring features and validating their availability. When it comes to monitoring PaaS services, especially Azure App Service, one of the best services is Azure Application Insights. In fact, they are available as one of the settings of your application:

Figure 9.10 – Applications Insights blade

Initially, this feature is disabled and requires you to install an extension to get things working. So, let’s begin:

  1. Install the extension directly from the Azure portal using the Turn on site extension button:

Figure 9.11 – Enabling the extension
The extension can also be installed during a deployment (for example, using ARM templates). In this section, we are covering a scenario where redeployment is not possible/requires many additional actions before it can be performed.
  1. Once you click the button, you will have to configure the plugin by providing additional information about Azure Application Insights such as resource name, the technology stack you are aiming at (.NET, .NET Core, Node.js, or Java), and enabled features (Profiler, Snapshot debugger, and so on):
Figure 9.12 – Additional features such as Snapshot debugger and Profiler
  1. The last thing required here is clicking on the Apply button and confirming that you want to apply the changes:

Figure 9.13 – Confirming the changes

Now, the process of provisioning the extension will start. This can take several minutes to complete.

Note that this will restart your website, so ensure you are not performing this action during the peak traffic hours of your application!

Now, let’s check the actual capabilities of the feature.

Exploring capabilities of Azure Application Insights

Once your Azure Application Insights instance is ready, you can go to it and start browsing its capabilities. Let’s check it out:

  1. The thing we are interested in the most here is the Availability blade. You can find it in the Investigate section:

Figure 9.14 – Availability blade
  1. From this screen, you will be able to perform two important actions:
    • Verify the availability of your application.
    • Create a test that periodically checks the status of your website.
  2. To create a test, click on the + Create Test button:

Figure 9.15 – Creating an availability test
  1. From the new screen, you will be able to configure a test where you can decide how you want to access an application and specify the criteria that will mark the test as failing:

Figure 9.16 – Availability test settings

Once your availability tests have run, you will be able to see their results, as shown in the following screenshot:

Figure 9.17 – Working availability test

Note the following things:

  • Tests can be executed from different locations, which will ensure that your problem is or is not related to a region.
  • You can have multiple tests covering different scenarios.
  • For more advanced scenarios, upload the WEBTEST files (go to https://docs.microsoft.com/en-us/visualstudio/test/quickstart-create-a-load-test-project?view=vs-2019), which cover multi-step scenarios of testing web applications.
  • When availability tests are failing, you can add email recipients who will be notified when things are not working at that moment in time.

Azure Application Insights is a powerful service that is not limited to availability tests only. In the Further reading section, you will find additional information about using additional tools such as alerts, Smart Detection, and API access. Depending on your use case, you can leverage this Azure resource as either a sink for metrics or a complex solution and a dashboard, which will cover most of your requirements when it comes to web application monitoring.

For now, we have covered monitoring features for various Azure services such as Azure VMs, storage accounts, and Azure App Service. The next topic will help you understand Azure SQL backup capabilities.

Related Articles

How to add swap space on Ubuntu 21.04 Operating System

How to add swap space on Ubuntu 21.04 Operating System

The swap space is a unique space on the disk that is used by the system when Physical RAM is full. When a Linux machine runout the RAM it use swap space to move inactive pages from RAM. Swap space can be created into Linux system in two ways, one we can create a...

read more

Lorem ipsum dolor sit amet consectetur

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

five × 1 =