Deploy Azure Monitor Application Insights Agent for on-premises servers

Application Insights Agent (formerly named Status Monitor V2) is a PowerShell module published to the PowerShell Gallery. It replaces Status Monitor. Telemetry is sent to the Azure portal, where you can monitor your app.

For a complete list of supported autoinstrumentation scenarios, see Supported environments, languages, and resource providers.

Note

The module currently supports codeless instrumentation of ASP.NET and ASP.NET Core web apps hosted with IIS. Use an SDK to instrument Java and Node.js applications.

Application Insights Agent is located in the PowerShell Gallery.

PowerShell Gallery icon.

Instructions

  • To get started with concise code samples, see the Getting started tab.
  • For a deep dive on how to get started, see the Detailed instructions tab.
  • For PowerShell API reference, see the API reference tab.
  • For release note updates, see the Release notes tab.

This tab contains the quickstart commands that are expected to work for most environments. The instructions depend on PowerShell Gallery to distribute updates. These commands support the PowerShell -Proxy parameter.

For an explanation of these commands, customization instructions, and information about troubleshooting, see the detailed instructions.

If you don't have an Azure subscription, create a free account before you begin.

Use PowerShell Gallery for download and installation.

Installation prerequisites

To enable monitoring, you must have a connection string. A connection string is displayed on the Overview pane of your Application Insights resource. For more information, see Connection strings.

Note

As of April 2020, PowerShell Gallery has deprecated TLS 1.1 and 1.0.

For more prerequisites that you might need, see PowerShell Gallery TLS support.

Run PowerShell as an admin.

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process -Force
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
Install-Module -Name PowerShellGet -Force

Close PowerShell.

Install Application Insights Agent

Run PowerShell as an admin.

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process -Force
Install-Module -Name Az.ApplicationMonitor -AllowPrerelease -AcceptLicense

Note

The AllowPrerelease switch in the Install-Module cmdlet allows installation of the beta release.

For more information, see Install-Module.

Enable monitoring

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process -Force
Enable-ApplicationInsightsMonitoring -ConnectionString 'InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://xxxx.applicationinsights.azure.com/'

Download and install manually (offline option)

You can also download and install manually.

Download the module

Manually download the latest version of the module from PowerShell Gallery.

Unzip and install Application Insights Agent

$pathToNupkg = "C:\Users\t\Desktop\Az.ApplicationMonitor.0.3.0-alpha.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

Enable monitoring

Enable-ApplicationInsightsMonitoring -ConnectionString 'InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://xxxx.applicationinsights.azure.com/'

Frequently asked questions

This section provides answers to common questions.

Does Application Insights Agent support proxy installations?

Yes. There are multiple ways to download Application Insights Agent:

  • If your computer has internet access, you can onboard to the PowerShell Gallery by using -Proxy parameters.
  • You can also manually download the module and either install it on your computer or use it directly.

Each of these options is described in the detailed instructions.

Does Application Insights Agent support ASP.NET Core applications?

Yes. In Application Insights Agent 2.0.0 and later, ASP.NET Core applications hosted in IIS are supported.

How do I verify that the enablement succeeded?

  • You can use the Get-ApplicationInsightsMonitoringStatus cmdlet to verify that enablement succeeded.
    • Use Live Metrics to quickly determine if your app is sending telemetry.

    • You can also use Log Analytics to list all the cloud roles currently sending telemetry:

      union * | summarize count() by cloud_RoleName, cloud_RoleInstance
      

How do I achieve proxy passthrough?

To achieve proxy passthrough, configure a machine-level proxy or an application-level proxy. See DefaultProxy.

Example Web.config:

<system.net>
    <defaultProxy>
    <proxy proxyaddress="http://xx.xx.xx.xx:yyyy" bypassonlocal="true"/>
    </defaultProxy>
</system.net>

Troubleshooting

See the dedicated troubleshooting article.

Test connectivity between your application host and the ingestion service

Application Insights SDKs and agents send telemetry to get ingested as REST calls to our ingestion endpoints. You can test connectivity from your web server or application host machine to the ingestion service endpoints by using raw REST clients from PowerShell or curl commands. See Troubleshoot missing application telemetry in Azure Monitor Application Insights.

Next steps

View your telemetry:

Add more telemetry:

Do more with Application Insights Agent: