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

This article contains the quickstart commands expected to work for most environments. The instructions depend on the 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.

Install prerequisites

  • To enable monitoring you will require a connection string. A connection string is displayed on the Overview blade of your Application Insights resource. For more information, see page Connection Strings.

Note

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

For additionnal prerequisites that you might need, see PowerShell Gallery TLS Support.

Run PowerShell as 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 Admin.

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

Enable monitoring

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process -Force
Enable-ApplicationInsightsMonitoring -ConnectionString 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'

Download and install manually (offline option)

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 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'

Next steps

View your telemetry:

Add more telemetry:

Do more with Application Insights Agent: