Application Insights

Application Insights is an Azure-based service that allows web developers and the alike monitor and detect performance issues with their web platforms. I will provide an example to monitor a web app built on a traditional Windows Server.

You can analyze the follow telemetry:

  • Application map of the monitored platform, for example, the web instance and associated database server
  • Live metrics provides statistics of Incoming, Outgoing requests, including CPU and committed memory loads
  • Failures
  • Performance

To get started, you need the following:

  • An Application Insights resource, including a desired region, resource group, subscription and name
  • Define the Resource Mode type, ideally 'Workspace-based' rather than 'Classic', which'll be retired in February 2024

Once your Application Insights resource has been created, note the Instrumentation Key under the Overview blade as we'll need this to on-board a server in the example below. To start, install the required Az.ApplicationMonitor PowerShell module:

Install-Module -Name Az.ApplicationMonitor -RequiredVersion 1.1.2
To on-board the server to the resource:

Enable-ApplicationInsightsMonitoring -InstrumentationKey 11223344-aabb-ccdd-eeff-112233aabbccdd

Check the status:
If you encounter issues installing the Application Insight cmdlets, try downloading the nupkg file manually:
$pathToNupkg = "C:\Software\az.applicationmonitor.1.1.2.nupkg"
$pathToZip = ([io.path]::ChangeExtension($pathToNupkg, "zip"))
$pathToNupkg | rename-item -newname $pathToZip
$pathInstalledModule = "$Env:ProgramFiles\WindowsPowerShell\Modules\Az.ApplicationMonitor"
Expand-Archive -LiteralPath $pathToZip -DestinationPath $pathInstalledModule
Once you have on-boarded your server, allow 10 or so minutes for the telemetry to feed back to the Applications Insight resource to be analyzed.