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.
Download and install via PowerShell Gallery
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:
- Explore metrics to monitor performance and usage.
- Search events and logs to diagnose problems.
- Use Log Analytics for more advanced queries.
- Create dashboards.
Add more telemetry:
- Create web tests to make sure your site stays live.
- Add web client telemetry to see exceptions from webpage code and to enable trace calls.
- Add the Application Insights SDK to your code so that you can insert trace and log calls.
Do more with Application Insights Agent:
- Review the detailed instructions for an explanation of the commands in this article.
- Troubleshoot Application Insights Agent.
Feedback
Submit and view feedback for