You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-monitor/vm/vminsights-enable-powershell.md
+4-106Lines changed: 4 additions & 106 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ ms.topic: conceptual
5
5
ms.custom: devx-track-azurepowershell
6
6
author: guywi-ms
7
7
ms.author: guywild
8
-
ms.date: 12/13/2023
8
+
ms.date: 05/20/2024
9
9
---
10
10
11
11
# Enable VM insights by using PowerShell
@@ -14,13 +14,11 @@ This article describes how to enable VM insights on Azure virtual machines by us
14
14
- Azure Virtual Machines
15
15
- Azure Virtual Machine Scale Sets
16
16
17
-
This script installs VM extensions for Log Analytics/Azure Monitoring Agent (AMA) and, if necessary, the Dependency Agent to enable VM Insights. If AMA is onboarded, a Data Collection Rule (DCR) and a User Assigned Managed Identity (UAMI) is also associated with the virtual machines and virtual machine scale sets.
This script installs VM extensions for Azure Monitoring Agent (AMA) and, if necessary, the Dependency Agent to enable VM Insights. If AMA is onboarded, a Data Collection Rule (DCR) and a User Assigned Managed Identity (UAMI) is also associated with the virtual machines and virtual machine scale sets.
21
18
22
19
> [!NOTE]
23
20
> Azure Monitor Agent is supported from version 1.10.1.
21
+
24
22
## Prerequisites
25
23
26
24
You need to:
@@ -48,11 +46,7 @@ For a list of the script's argument details and example usage, run `Get-Help`.
48
46
Get-Help Install-VMInsights.ps1 -Detailed
49
47
```
50
48
51
-
Use the script to enable VM insights using Azure Monitoring Agent and Dependency Agent, or Log Analytics Agent.
52
-
53
-
54
-
55
-
### [Azure Monitor Agent](#tab/AMA)
49
+
Use the script to enable VM insights using Azure Monitoring Agent and Dependency Agent.
56
50
57
51
When you enable VM insights using Azure Monitor Agent, the script associates a Data Collection Rule (DCR) and a User Assigned Managed Identity (UAMI) to the VM/Virtual Machine Scale Set. The UAMI settings are passed to the Azure Monitor Agent extension.
+`-WorkspaceKey <String>` Log Analytics Workspace primary or secondary key.
145
-
146
-
Optional Arguments:
147
-
+`-ReInstall [<SwitchParameter>]` Trigger removal of existing Log analytics extension and reinstallation to migrate log analytics workspaces with Legacy Agent (Linux) - OMSAgent.
148
-
+`-Name <String>` Name of the VM or Virtual Machine Scale Set to be onboarded. If not specified, all VMs and Virtual Machine Scale Sets in the subscription or resource group are onboarded. Use wildcards to specify multiple VMs or Virtual Machine Scale Sets.
149
-
+`- ResourceGroup <String>` Name of the resource group containing the VM or Virtual Machine Scale Set to be onboarded. If not specified, all VMs and Virtual Machine Scale Sets in the subscription are onboarded. Use wildcards to specify multiple resource groups.
150
-
+`-PolicyAssignmentName <String>` Only include VMs associated with this policy. When the PolicyAssignmentName parameter is specified, the VMs part of the parameter SubscriptionId are considered.
151
-
+`-TriggerVmssManualVMUpdate [<SwitchParameter>]` Trigger the update of VM instances in a scale set whose upgrade policy is set to Manual.
152
-
+`-WhatIf [<SwitchParameter>]` Get info about expected effect of the commands in the script.
153
-
+`-Confirm [<SwitchParameter>]` Confirm each action in the script.
154
-
+`-Approve [<SwitchParameter>]` Provide the approval for the installation to start with no confirmation prompt for the listed VM's/Virtual Machine Scale Sets.
155
-
156
-
The script supports wildcards for `-Name` and `-ResourceGroup`. For example, `-Name vm*` enables VM insights for all VMs and Virtual Machine Scale Sets that start with "vm". For more information, see [Wildcards in Windows PowerShell](/powershell/module/microsoft.powershell.core/about/about_wildcards).
- See [Supported operating systems](./vminsights-enable-overview.md#supported-operating-systems) to ensure that the operating system of the virtual machine or Virtual Machine Scale Set you're enabling is supported.
24
23
- See [Manage the Azure Monitor agent](../agents/azure-monitor-agent-manage.md#prerequisites) for prerequisites related to Azure Monitor agent.
25
24
- To enable network isolation for Azure Monitor Agent, see [Enable network isolation for Azure Monitor Agent by using Private Link](../agents/azure-monitor-agent-private-link.md).
26
25
27
26
## Resource Manager templates
28
-
Use the Azure Resource Manager templates provided in this article to onboard virtual machines and Virtual Machine Scale Sets using Azure Monitor agent and Log Analytics agent. The templates install the required agents and perform the configuration required to onboard to machine to VM insights.
27
+
Use the Azure Resource Manager templates provided in this article to onboard virtual machines and Virtual Machine Scale Sets using Azure Monitor agent. The templates install the required agents and perform the configuration required to onboard to machine to VM insights.
29
28
30
29
>[!NOTE]
31
30
> Deploy the template in the same resource group as the virtual machine or virtual machine scale set being enabled.
@@ -35,7 +34,7 @@ First deploy the data collection rule, and then install agents to use that data
35
34
36
35
### Deploy data collection rule
37
36
38
-
This step installs a data collection rule, named `MSVMI-{WorkspaceName}`, in the same resource group as your Log Analytics workspace:
37
+
This step installs a data collection rule, named `MSVMI-{WorkspaceName}`:
39
38
40
39
1. Download the [VM insights data collection rule templates](https://github.com/Azure/AzureMonitorForVMs-ArmTemplates/releases/download/vmi_ama_ga/DeployDcr.zip).
41
40
1.[Deploy a template](#deploy-templates) from the downloaded zip file. The following table describes the templates available:
@@ -45,7 +44,6 @@ This step installs a data collection rule, named `MSVMI-{WorkspaceName}`, in the
45
44
| DeployDcr\\<br>PerfAndMapDcr | DeployDcrTemplate<br>DeployDcrParameters | Enable both Performance and Map experience of VM Insights. |
46
45
| DeployDcr\\<br>PerfOnlyDcr | DeployDcrTemplate<br>DeployDcrParameters | Enable only Performance experience of VM Insights. |
47
46
48
-
49
47
### Deploy agents to machines
50
48
51
49
After you create the data collection rule, deploy:
@@ -56,29 +54,6 @@ After you create the data collection rule, deploy:
56
54
> [!NOTE]
57
55
> If your virtual machines scale sets have an upgrade policy set to manual, VM insights will not be enabled for instances by default after installing the template. You must manually upgrade the instances.
58
56
59
-
## Enable VM insights using Log Analytics agent
60
-
Download the [Logs Analytics agent templates](https://aka.ms/VmInsightsARMTemplates). You must first configure the workspace and can then install agents to use that DCR.
61
-
62
-
### Configure workspace
63
-
You only need to perform this step once for each workspace that will use VM insights.
64
-
65
-
66
-
| Folder | File | Description |
67
-
|:---|:---|
68
-
| ConfigureWorkspace | ConfigureWorkspaceTemplate.json<br>ConfigureWorkspaceParameters | Install *VMInsights* solution required for the workspace. |
69
-
70
-
### Deploy agents to machines
71
-
Once the workspace has been configured, deploy the agents using one of the templates in the following table. Templates are available that apply to an existing machine or create a new machine enabled for VM insights.
72
-
73
-
74
-
| Folder | File | Description |
75
-
|:---|:---|
76
-
| NewVmOnboarding | NewVmOnboardingTemplate.json<br>NewVmOnboardingParameters.json | Creates a virtual machine and enables it to be monitored with VM insights. |
77
-
| ExistingVmOnboarding | ExistingVmOnboarding.json<br>ExistingVmOnboarding.json | Enables VM insights on existing virtual machine. |
78
-
| NewVmssOnboarding | NewVmssOnboarding.json<br>NewVmssOnboarding.json | Creates a Virtual Machine Scale Set and enables it to be monitored with VM insights. |
79
-
| ExistingVmssOnboarding | ExistingVmssOnboarding.json<br>ExistingVmssOnboarding.json | Enables VM insights on existing Virtual Machine Scale Set. |
80
-
| ExistingArcVmOnboarding | ExistingArcVmOnboarding.json<br>ExistingArcVmOnboarding.json | Enables VM insights on existing Arc-enabled server. |
81
-
82
57
## Deploy templates
83
58
Each folder in the download has a template and a parameters file. Modify the parameters file with required details such as Virtual Machine Resource ID, Workspace resource ID, data collection rule resource ID, Location, and OS Type. Don't modify the template file unless you need to customize it for your particular scenario.
0 commit comments