Hands On with Azure App Insight
Tags: azureappservice, azurewebapp, azure, monitorapps
Published: 2021-04-07 11:25:36

---
title: Hands On with Azure App Insight
published: true
date: 2021-02-21 13:18:15 UTC
tags: azureappservice,azurewebapp,azure,monitorapps
canonical_url: https://berviantoleo.medium.com/hands-on-with-azure-app-insight-67e15eebfdfd
---

#### Monitor your apps!

![](https://cdn-images-1.medium.com/max/1024/0*ISoWRHFdhw1EE67c)<figcaption>Photo by <a href="https://unsplash.com/@hostreviews?utm_source=medium&amp;utm_medium=referral">Stephen Phillips - Hostreviews.co.uk</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption>

> If you want to know more Azure App Insight, please visit the documentation [here](https://docs.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview).

[What is Azure Application Insights? - Azure Monitor](https://docs.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview)

Why I write this? Yeah, to remember what I’ve learned. This article only summary from this [module](https://docs.microsoft.com/en-us/learn/modules/instrument-web-app-code-with-application-insights/).

[Instrument server-side web application code with Application Insights - Learn](https://docs.microsoft.com/en-us/learn/modules/instrument-web-app-code-with-application-insights/)

> Note: Hemm… Because some features from Azure very quick to changes, somehow the guide from that module not relevant again. This article also maybe not relevant after some months!

### Step by Step

#### Prepare your apps!

In this article, we use _NetCore._ So we can install the library **_Microsoft.ApplicationInsights.AspNetCore_**

The repositories come from here, you also can deploy from there!

[bervProject/NETCoreAPIBoilerplate](https://github.com/bervProject/NETCoreAPIBoilerplate)

**Easy setup!**

I just add this one line to **ConfigureServices** after install the library/nuget

```
services.AddApplicationInsightsTelemetry();
```

**Check your apps**

I assume you know how to deploy the Web Apps. After finished deploy, visit this link: [https://<your\_app\_name>.azurewebsites.net/api/v1.0/WeatherForecast](https://testinsight12.azurewebsites.net/api/v1.0/WeatherForecast).

![](https://cdn-images-1.medium.com/max/1024/1*Fb6ccJEBRCUV6cMptziK5A.png)<figcaption>Example Visit</figcaption>

In that link, we also trigger the app insight event.

> Some note:

> Because Azure will not track **Free/Shared** plan, please make sure your **AppServicePlan** is **Basic** or **more**. Sadly, the sandbox not allowed it (when I try the sandbox from that module). :(

#### Visit your App Insight

In my case, I still need to turn on the App Insight to **Recommended** (previously Basic), don’t forget to turn on the Profiler.

![](https://cdn-images-1.medium.com/max/834/1*iR5SyKwmdcxUJuBlwhPF8A.png)<figcaption>Application Insight (enabled)</figcaption>

![](https://cdn-images-1.medium.com/max/1024/1*Yom2uCWb-T1uZJNScSuoUQ.png)<figcaption>Application Insight Dashboard</figcaption>

You can check to **Investigate** > **Transaction Search** for more information about your previous custom event.

In my side, will looks like this.

![](https://cdn-images-1.medium.com/max/1024/1*8V9soY1FYeZ0aThHF16Zvw.png)<figcaption>Application Insight (Transaction Search)</figcaption>

#### Congrats!

![](https://cdn-images-1.medium.com/max/1024/0*B_02VNPVXt-tmukR)<figcaption>Photo by <a href="https://unsplash.com/@eilisgarvey?utm_source=medium&amp;utm_medium=referral">Eilis Garvey</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption>

Yeah! You’re setup it correctly. Anyway, if you still confused. You can visit the module for the basic knowledge. I know some steps is outdate!

#### My Videos

{% youtube zq3AjcW_Pps %}

#### Clean Up!

Don’t forget always to clean up your resource whenever you don’t need it again.