In this article, let’s create Azure Web App resources and create a Web App from Marketplace. Enable application insights using Basics tab and Monitor + secure tab configurations. Configure instrumentation settings to enables monitoring without changing the application code. Setup a .NET project to create and deploy Blazor application. View metrics (application activities) in Application Insights to monitor Failed requests, Server response time, Server requests, Availability, etc. After this exercise, you will be able to implement a comprehensive monitor an application with autoinstrumentation without changing the application code along with deployments and migrations simpler.

Following tasks are performed in this article:

Create Azure Web App Resources and Web App Page

First basic task is to create and make ready Azure web app resources to Azure using Azure Portal and create a Web App from Marketplace. Perform following steps one by one in to Azure Portal to achieve this.

Create Azure Web App Resource

Create Web App

Once click on Web App option it will open Create Web App page with various configuration options as mentioned in next below section.

Enable Application Insights

In Create Web App page there are various tabs such as Basics, Database, Container, Monitor + secure, Tags, Review + create, etc. to be configured appropriately. Perform the following steps one by one to configure Basics and Monitor + secure tab configuration .

Create Web App

Basics tab configuration

Now it’s time to enter the basic settings for Basic panel configuration to create a web app resource. For unspecified options leave to their default values as it is. Following are important setting to be configured:

Monitor + secure tab settings

Click on “Monitor + secure” tab and enter below details as described to enable application insights:

Review + create tab submit

Navigate to “Review + create” tab to review and validate the configured deployment details. Complete final save by click on Create button to create the resources. It will take few minutes to complete the operation process.

Configure Instrumentation Settings

Now, let’s configure instrumentation settings for web app at service level. This section enables monitoring without changing the application code. Configure the following settings to configure instrumentation for an app at service level.

Create and Deploy Blazor App

Let’s set-up the .NET Blazor application and deploy it to above created Web App resource. Perform the following steps one by one in to Cloud Shell to achieve this.

.NET Project Setup

Set up one blazor application using .NET Client Library.

mkdir blazor1
cd blazor1
dotnet new blazor
dotnet build

Now, blazor application is completed and tested for any build time error. Next task is to deploy the Blazor application using Cloud Shell and then use the Azure Portal to view the application activities in Application Insights.

Deploy Blazor App

Now it’s time to deploy above created Blazor application to the App service. First, task is to publish it and then create a .zip file for the deployment.

dotnet publish -c Release -o ./publish1
cd publish1
zip -r ../app.zip .
cd ..
az webapp deploy --name MY-WEB-APP-NAME \
     --resource-group myResourceGroup1\
     --src-path ./app.zip

Now it's done. Let’s view application metrics in Application Insights as mentioned in next section. Here, don't close this tab as it will be used to view the results.

View metrics (application activities) in Application Insights

Perform following steps one by one in to Azure Portal to view metrics (application activities) in Application Insights.

Clean up resources

Once finished the exercise it’s recommended to delete cloud resources are being created to avoid the unnecessary resource usage and any future costs. Deleting a resource group will delete all resources contained within it. Perform following steps one by one in to Azure Portal to achieve this:

One can also clean up resources using Azure CLI as following:

Delete resource group - az group delete command is used to remove resource group.

az group delete \
     --name myResourceGroup1

Summary

Here, a complete process flow is described to create Azure Web App resources and Web App is created from Marketplace. Application insights is enabled using Basics tab and Monitor + secure tab configurations. Instrumentation settings are configured to enabled monitoring without changing the application code. .NET project is setup to create and deploy Blazor application. Metrics (application activities) in Application Insights are viewed to monitor the Failed requests, Server response time, Server requests, Availability, etc. Now,, you will be able to implement a comprehensive monitor an application with autoinstrumentation without changing the application code along with deployments and migrations simpler. Finally, resources are cleaned up.