Skip to content

Commit 675f332

Browse files
authored
Merge pull request #223650 from AaronMaxwell/aaronmax-azurevmvmssapps-copyedit-merge
merging PM edits with prior copy edits
2 parents 9df5a67 + 389b877 commit 675f332

File tree

1 file changed

+99
-110
lines changed

1 file changed

+99
-110
lines changed
Lines changed: 99 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,18 @@
11
---
2-
title: Monitor performance on Azure VMs - Application Insights
3-
description: Application performance monitoring for Azure Virtual Machines and Azure Virtual Machine Scale Sets. Chart load and response time, dependency information, and set alerts on performance.
2+
title: Monitor performance on Azure VMs - Azure Application Insights
3+
description: Application performance monitoring for Azure Virtual Machine and Azure Virtual Machine Scale Sets.
44
ms.topic: conceptual
5-
ms.date: 11/15/2022
5+
ms.date: 01/11/2023
66
ms.devlang: csharp, java, javascript, python
77
ms.custom: devx-track-azurepowershell
88
ms.reviewer: abinetabate
99
---
1010

11-
# Deploy Application Insights Agent on virtual machines and Virtual Machine Scale Sets
11+
# Application Insights for Azure VMs and Virtual Machine Scale Sets
1212

13-
Enabling monitoring for your .NET or Java-based web applications running on [Azure Virtual Machines](https://azure.microsoft.com/services/virtual-machines/) and [Azure Virtual Machine Scale Sets](../../virtual-machine-scale-sets/index.yml) is now easier than ever. Get all the benefits of using Application Insights without modifying your code.
13+
Enabling monitoring for your ASP.NET and ASP.NET Core IIS-hosted applications running on [Azure virtual machines](https://azure.microsoft.com/services/virtual-machines/) or [Azure Virtual Machine Scale Sets](../../virtual-machine-scale-sets/index.yml) is now easier than ever. Get all the benefits of using Application Insights without modifying your code.
1414

15-
This article walks you through enabling Application Insights monitoring by using Application Insights Agent. It also provides preliminary guidance for automating the process for large-scale deployments.
16-
17-
Java-based applications running on Azure Virtual Machines and Azure Virtual Machine Scale Sets are monitored with the [Application Insights Java 3.0 agent](./java-in-process-agent.md), which is generally available.
18-
19-
> [!IMPORTANT]
20-
> Application Insights Agent for ASP.NET and ASP.NET Core applications running on Azure Virtual Machines and Azure Virtual Machine Scale Sets is currently in public preview. For monitoring your ASP.NET applications running on-premises, use [Application Insights Agent for on-premises servers](./status-monitor-v2-overview.md), which is generally available and fully supported.
21-
>
22-
> The preview version for Azure Virtual Machines and Azure Virtual Machine Scale Sets is provided without a service-level agreement. We don't recommend it for production workloads. Some features might not be supported, and some might have constrained capabilities.
23-
>
24-
> For more information, see [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/).
15+
This article walks you through enabling Application Insights monitoring using the Application Insights Agent and provides preliminary guidance for automating the process for large-scale deployments.
2516

2617
## Enable Application Insights
2718

@@ -30,19 +21,18 @@ Auto-instrumentation is easy to enable. Advanced configuration isn't required.
3021
For a complete list of supported auto-instrumentation scenarios, see [Supported environments, languages, and resource providers](codeless-overview.md#supported-environments-languages-and-resource-providers).
3122

3223
> [!NOTE]
33-
> Auto-instrumentation is available for ASP.NET, ASP.NET Core IIS-hosted applications, and Java. Use an SDK to instrument Node.js and Python applications hosted on Azure Virtual Machines and Azure Virtual Machine Scale Sets.
34-
24+
> Auto-instrumentation is available for ASP.NET, ASP.NET Core IIS-hosted applications and Java. Use an SDK to instrument Node.js and Python applications hosted on an Azure virtual machines and Virtual Machine Scale Sets.
3525
### [.NET Framework](#tab/net)
3626

37-
The Application Insights Agent autocollects the same dependency signals out-of-the-box as the SDK. To learn more, see [Dependency autocollection](asp-net-dependencies.md#net).
27+
The Application Insights Agent auto-collects the same dependency signals out-of-the-box as the SDK. See [Dependency auto-collection](./auto-collect-dependencies.md#net) to learn more.
3828

39-
### [.NET Core/.NET](#tab/core)
29+
### [.NET Core / .NET](#tab/core)
4030

41-
The Application Insights Agent autocollects the same dependency signals out-of-the-box as the SDK. To learn more, see [Dependency autocollection](asp-net-dependencies.md#net).
31+
The Application Insights Agent auto-collects the same dependency signals out-of-the-box as the SDK. See [Dependency auto-collection](./auto-collect-dependencies.md#net) to learn more.
4232

4333
### [Java](#tab/Java)
4434

45-
We recommend [Application Insights Java 3.0 agent](./java-in-process-agent.md) for Java. The most popular libraries, frameworks, logs, and dependencies are [autocollected](./java-in-process-agent.md#autocollected-requests) along with many [other configurations](./java-standalone-config.md).
35+
We recommend [Application Insights Java 3.0 agent](./java-in-process-agent.md) for Java. The most popular libraries, frameworks, logs, and dependencies are [auto-collected](./java-in-process-agent.md#autocollected-requests), with a multitude of [other configurations](./java-standalone-config.md)
4636

4737
### [Node.js](#tab/nodejs)
4838

@@ -54,76 +44,97 @@ To monitor Python apps, use the [SDK](./opencensus-python.md).
5444

5545
---
5646

57-
## Manage Application Insights Agent for .NET applications on virtual machines by using PowerShell
47+
Before installing the Application Insights Agent, you'll need a connection string. [Create a new Application Insights Resource](./create-workspace-resource.md) or copy the connection string from an existing application insights resource.
48+
49+
### Enable Monitoring for Virtual Machines
50+
51+
### Method 1 - Azure portal / GUI
52+
1. Go to Azure portal and navigate to your Application Insights resource and copy your connection string to the clipboard.
53+
54+
:::image type="content"source="./media/azure-vm-vmss-apps/connect-string.png" alt-text="Screenshot of the connection string." lightbox="./media/azure-vm-vmss-apps/connect-string.png":::
55+
56+
2. Navigate to your virtual machine, open the "Extensions + applications" pane under the "Settings" section in the left side navigation menu, and select "+ Add"
5857

59-
Before you install Application Insights Agent, you'll need a connection string. [Create a new Application Insights resource](./create-new-resource.md) or copy the connection string from an existing Application Insights resource.
58+
:::image type="content"source="./media/azure-vm-vmss-apps/add-extension.png" alt-text="Screenshot of the extensions pane with an add button." lightbox="media/azure-vm-vmss-apps/add-extension.png":::
59+
60+
3. Select the "Application Insights Agent" card, and select "Next"
61+
62+
:::image type="content"source="./media/azure-vm-vmss-apps/select-extension.png" alt-text="Screenshot of the install an extension pane with a next button." lightbox="media/azure-vm-vmss-apps/select-extension.png":::
63+
64+
4. Paste the connection string you copied at step 1 and select "Review + Create"
65+
66+
:::image type="content"source="./media/azure-vm-vmss-apps/install-extension.png" alt-text="Screenshot of the create pane with a review and create button." lightbox="media/azure-vm-vmss-apps/install-extension.png":::
67+
68+
#### Method 2 - PowerShell
6069

6170
> [!NOTE]
62-
> If you're new to PowerShell, see the [Get Started Guide](/powershell/azure/get-started-azureps).
71+
> New to PowerShell? Check out the [Get Started Guide](/powershell/azure/get-started-azureps).
6372
64-
Install or update Application Insights Agent as an extension for virtual machines:
73+
Install or update the Application Insights Agent as an extension for Azure virtual machines
6574

6675
```powershell
67-
$publicCfgJsonString = '
76+
# define variables to match your environment before running
77+
$ResourceGroup = "<myVmResourceGroup>"
78+
$VMName = "<myVmName>"
79+
$Location = "<myVmLocation>"
80+
$ConnectionString = "<myAppInsightsResourceConnectionString>"
81+
82+
$publicCfgJsonString = @"
6883
{
69-
"redfieldConfiguration": {
70-
"instrumentationKeyMap": {
71-
"filters": [
72-
{
73-
"appFilter": ".*",
74-
"machineFilter": ".*",
75-
"virtualPathFilter": ".*",
76-
"instrumentationSettings" : {
77-
"connectionString": "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://xxxx.applicationinsights.azure.com/" # Application Insights connection string, create new Application Insights resource if you don't have one. https://portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/microsoft.insights%2Fcomponents
78-
}
84+
"redfieldConfiguration": {
85+
"instrumentationKeyMap": {
86+
"filters": [
87+
{
88+
"appFilter": ".*",
89+
"machineFilter": ".*",
90+
"virtualPathFilter": ".*",
91+
"instrumentationSettings" : {
92+
"connectionString": "$ConnectionString"
93+
}
94+
}
95+
]
7996
}
80-
]
8197
}
82-
}
83-
}
84-
';
85-
$privateCfgJsonString = '{}';
98+
}
99+
"@
86100
87-
Set-AzVMExtension -ResourceGroupName "<myVmResourceGroup>" -VMName "<myVmName>" -Location "<myVmLocation>" -Name "ApplicationMonitoring" -Publisher "Microsoft.Azure.Diagnostics" -Type "ApplicationMonitoringWindows" -Version "2.8" -SettingString $publicCfgJsonString -ProtectedSettingString $privateCfgJsonString
88-
```
101+
$privateCfgJsonString = '{}'
102+
103+
Set-AzVMExtension -ResourceGroupName $ResourceGroup -VMName $VMName -Location $Location -Name "ApplicationMonitoringWindows" -Publisher "Microsoft.Azure.Diagnostics" -Type "ApplicationMonitoringWindows" -Version "2.8" -SettingString $publicCfgJsonString -ProtectedSettingString $privateCfgJsonString
89104
105+
```
90106
> [!NOTE]
91-
> You can install or update Application Insights Agent as an extension across multiple virtual machines at scale by using a PowerShell loop.
92-
93-
Uninstall Application Insights Agent extension from a virtual machine:
107+
> For more complicated at-scale deployments you can use a PowerShell loop to install or update the Application Insights Agent extension across multiple VMs.
94108
109+
Query Application Insights Agent extension status for Azure Virtual Machine
95110
```powershell
96-
Remove-AzVMExtension -ResourceGroupName "<myVmResourceGroup>" -VMName "<myVmName>" -Name "ApplicationMonitoring"
111+
Get-AzVMExtension -ResourceGroupName "<myVmResourceGroup>" -VMName "<myVmName>" -Name ApplicationMonitoringWindows -Status
97112
```
98113

99-
Query Application Insights Agent extension status for a virtual machine:
100-
114+
Get list of installed extensions for Azure Virtual Machine
101115
```powershell
102-
Get-AzVMExtension -ResourceGroupName "<myVmResourceGroup>" -VMName "<myVmName>" -Name ApplicationMonitoring -Status
116+
Get-AzResource -ResourceId "/subscriptions/<mySubscriptionId>/resourceGroups/<myVmResourceGroup>/providers/Microsoft.Compute/virtualMachines/<myVmName>/extensions"
103117
```
104-
105-
Get a list of installed extensions for a virtual machine:
106-
118+
Uninstall Application Insights Agent extension from Azure Virtual Machine
107119
```powershell
108-
Get-AzResource -ResourceId "/subscriptions/<mySubscriptionId>/resourceGroups/<myVmResourceGroup>/providers/Microsoft.Compute/virtualMachines/<myVmName>/extensions"
109-
110-
# Name : ApplicationMonitoring
111-
# ResourceGroupName : <myVmResourceGroup>
112-
# ResourceType : Microsoft.Compute/virtualMachines/extensions
113-
# Location : southcentralus
114-
# ResourceId : /subscriptions/<mySubscriptionId>/resourceGroups/<myVmResourceGroup>/providers/Microsoft.Compute/virtualMachines/<myVmName>/extensions/ApplicationMonitoring
120+
Remove-AzVMExtension -ResourceGroupName "<myVmResourceGroup>" -VMName "<myVmName>" -Name "ApplicationMonitoring"
115121
```
116122

117-
You can also view installed extensions in the [Azure Virtual Machine section](../../virtual-machines/extensions/overview.md) of the Azure portal.
118-
119123
> [!NOTE]
120-
> Verify installation by selecting **Live Metrics Stream** within the Application Insights resource associated with the connection string you used to deploy the Application Insights Agent extension. If you're sending data from multiple virtual machines, select the target virtual machines under **Server Name**. It might take up to a minute for data to begin flowing.
124+
> Verify installation by selecting **Live Metrics Stream** within the Application Insights resource associated with the connection string you used to deploy the Application Insights Agent extension. If you're sending data from multiple Virtual Machines, select the target Azure virtual machines under **Server Name**. It might take up to a minute for data to begin flowing.
121125
122-
## Manage Application Insights Agent for .NET applications on Virtual Machine Scale Sets by using PowerShell
126+
## Enable Monitoring for Virtual Machine Scale Sets
123127

124-
Install or update Application Insights Agent as an extension for a Virtual Machine Scale Set:
128+
### Method 1 - Azure portal / GUI
129+
Follow the prior steps for VMs, but navigate to your Virtual Machine Scale Sets instead of your VM.
125130

131+
### Method 2 - PowerShell
132+
Install or update the Application Insights Agent as an extension for Azure Virtual Machine Scale Set
126133
```powershell
134+
# set resource group, vmss name, and connection string to reflect your enivornment
135+
$ResourceGroup = "<myVmResourceGroup>"
136+
$VMSSName = "<myVmName>"
137+
$ConnectionString = "<myAppInsightsResourceConnectionString>"
127138
$publicCfgHashtable =
128139
@{
129140
"redfieldConfiguration"= @{
@@ -134,86 +145,64 @@ $publicCfgHashtable =
134145
"machineFilter"= ".*";
135146
"virtualPathFilter"= ".*";
136147
"instrumentationSettings" = @{
137-
"connectionString"= "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://xxxx.applicationinsights.azure.com/" # Application Insights connection string, create new Application Insights resource if you don't have one. https://portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/microsoft.insights%2Fcomponents
148+
"connectionString"= "$ConnectionString"
138149
}
139150
}
140151
)
141152
}
142153
}
143154
};
144155
$privateCfgHashtable = @{};
145-
146-
$vmss = Get-AzVmss -ResourceGroupName "<myResourceGroup>" -VMScaleSetName "<myVmssName>"
147-
156+
$vmss = Get-AzVmss -ResourceGroupName $ResourceGroup -VMScaleSetName $VMSSName
148157
Add-AzVmssExtension -VirtualMachineScaleSet $vmss -Name "ApplicationMonitoringWindows" -Publisher "Microsoft.Azure.Diagnostics" -Type "ApplicationMonitoringWindows" -TypeHandlerVersion "2.8" -Setting $publicCfgHashtable -ProtectedSetting $privateCfgHashtable
149-
150-
Update-AzVmss -ResourceGroupName $vmss.ResourceGroupName -Name $vmss.Name -VirtualMachineScaleSet $vmss
151-
152-
# Note: Depending on your update policy, you might need to run Update-AzVmssInstance for each instance.
153-
```
154-
155-
Uninstall the application monitoring extension from Virtual Machine Scale Sets:
156-
157-
```powershell
158-
$vmss = Get-AzVmss -ResourceGroupName "<myResourceGroup>" -VMScaleSetName "<myVmssName>"
159-
160-
Remove-AzVmssExtension -VirtualMachineScaleSet $vmss -Name "ApplicationMonitoring"
161-
162-
Update-AzVmss -ResourceGroupName $vmss.ResourceGroupName -Name $vmss.Name -VirtualMachineScaleSet $vmss
163-
164-
# Note: Depending on your update policy, you might need to run Update-AzVmssInstance for each instance.
158+
Update-AzVmss -ResourceGroupName $vmss.ResourceGroupName -Name $vmss
159+
# Note: Depending on your update policy, you might need to run Update-AzVmssInstance for each instance
165160
```
166161

167-
Query the application monitoring extension status for Virtual Machine Scale Sets:
168-
162+
Get list of installed extensions for Azure Virtual Machine Scale Sets
169163
```powershell
170-
# Not supported by extensions framework
164+
Get-AzResource -ResourceId "/subscriptions/<mySubscriptionId>/resourceGroups/<myResourceGroup>/providers/Microsoft.Compute/virtualMachineScaleSets/<myVmssName>/extensions"
171165
```
172166

173-
Get a list of installed extensions for Virtual Machine Scale Sets:
174-
167+
Uninstall application monitoring extension from Azure Virtual Machine Scale Sets
175168
```powershell
176-
Get-AzResource -ResourceId /subscriptions/<mySubscriptionId>/resourceGroups/<myResourceGroup>/providers/Microsoft.Compute/virtualMachineScaleSets/<myVmssName>/extensions
177-
178-
# Name : ApplicationMonitoringWindows
179-
# ResourceGroupName : <myResourceGroup>
180-
# ResourceType : Microsoft.Compute/virtualMachineScaleSets/extensions
181-
# Location :
182-
# ResourceId : /subscriptions/<mySubscriptionId>/resourceGroups/<myResourceGroup>/providers/Microsoft.Compute/virtualMachineScaleSets/<myVmssName>/extensions/ApplicationMonitoringWindows
169+
# set resource group and vmss name to reflect your environment
170+
$vmss = Get-AzVmss -ResourceGroupName "<myResourceGroup>" -VMScaleSetName "<myVmssName>"
171+
Remove-AzVmssExtension -VirtualMachineScaleSet $vmss -Name "ApplicationMonitoringWindows"
172+
Update-AzVmss -ResourceGroupName $vmss.ResourceGroupName -Name $vmss.Name -VirtualMachineScaleSet $vmss
173+
# Note: Depending on your update policy, you might need to run Update-AzVmssInstance for each instance
183174
```
184175

185176
## Troubleshooting
186177

187178
Find troubleshooting tips for the Application Insights Monitoring Agent extension for .NET applications running on Azure virtual machines and Virtual Machine Scale Sets.
188179

189-
> [!NOTE]
190-
> The following steps don't apply to Node.js and Python applications, which require SDK instrumentation.
191-
192-
Extension execution output is logged to files found in the following directories:
193-
180+
If you are having trouble deploying the extension, then review execution output which is logged to files found in the following directories:
194181
```Windows
195182
C:\WindowsAzure\Logs\Plugins\Microsoft.Azure.Diagnostics.ApplicationMonitoringWindows\<version>\
196183
```
184+
If your extension has deployed successfully but you're unable to see telemetry, it could be one of the following issues covered in [Agent Troubleshooting](https://learn.microsoft.com/troubleshoot/azure/azure-monitor/app-insights/status-monitor-v2-troubleshoot#known-issues).
185+
- Conflicting DLLs in an app's bin directory
186+
- Conflict with IIS shared configuration
197187

198188
[!INCLUDE [azure-monitor-app-insights-test-connectivity](../../../includes/azure-monitor-app-insights-test-connectivity.md)]
199189

200190
## Release notes
201191

202192
### 2.8.44
203193

204-
- Updated Application Insights .NET/.NET Core SDK to 2.20.1 - red field
205-
- Enabled SQL query collection
206-
- Enabled support for Azure Active Directory authentication
194+
- Updated Application Insights .NET/.NET Core SDK to 2.20.1 - red field.
195+
- Enabled SQL query collection.
196+
- Enabled support for Azure Active Directory authentication.
207197

208198
### 2.8.42
209199

210-
Updated Application Insights .NET/.NET Core SDK to 2.18.1 - red field
200+
- Updated ApplicationInsights .NET/.NET Core SDK to 2.18.1 - red field.
211201

212202
### 2.8.41
213203

214-
Added ASP.NET Core auto-instrumentation feature
204+
- Added ASP.NET Core auto-instrumentation feature.
215205

216206
## Next steps
217-
218-
* Learn how to [deploy an application to a Virtual Machine Scale Set](../../virtual-machine-scale-sets/virtual-machine-scale-sets-deploy-app.md).
219-
* [Set up availability web tests](monitor-web-app-availability.md) to be alerted if your endpoint is down.
207+
* Learn how to [deploy an application to an Azure Virtual Machine Scale Set](../../virtual-machine-scale-sets/virtual-machine-scale-sets-deploy-app.md).
208+
* [Set up Availability web tests](monitor-web-app-availability.md) to be alerted if your endpoint is down.

0 commit comments

Comments
 (0)