Get started with Azure Monitor Application Insights Agent for on-premises servers

This article 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/'

Next steps

View your telemetry:

Add more telemetry:

Do more with Application Insights Agent: