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/insights/vminsights-enable-at-scale-powershell.md
+61-50Lines changed: 61 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
-
title: Enable Azure Monitor for VMs (preview) using Azure PowerShell or Resource Manager template | Microsoft Docs
3
-
description: This article describes how you enable Azure Monitor for VMs for one or more Azure virtual machines or virtual machine scale sets using Azure PowerShell or Azure Resource Manager templates.
2
+
title: Enable Azure Monitor for VMs (preview) using Azure PowerShell or Resource Manager templates | Microsoft Docs
3
+
description: This article describes how you enable Azure Monitor for VMs for one or more Azure virtual machines or virtual machine scale sets by using Azure PowerShell or Azure Resource Manager templates.
4
4
services: azure-monitor
5
5
documentationcenter: ''
6
6
author: mgoedtel
@@ -15,30 +15,30 @@ ms.date: 05/09/2019
15
15
ms.author: magoedte
16
16
---
17
17
18
-
# Enable Azure Monitor for VMs (preview) using Azure PowerShell or Resource Manager template
18
+
# Enable Azure Monitor for VMs (preview) using Azure PowerShell or Resource Manager templates
This article explains how to enable Azure Monitor for VMs (preview) for Azure virtual machines or virtual machine scale sets using Azure PowerShell or Azure Resource Manager templates. At the end of this process you will have successfully begun monitoring all of your virtual machines and learn if any are experiencing performance or availability issues.
22
+
This article explains how to enable Azure Monitor for VMs (preview) for Azure virtual machines or virtual machine scale sets by using Azure PowerShell or Azure Resource Manager templates. At the end of this process, you will have successfully begun monitoring all of your virtual machines and learn if any are experiencing performance or availability issues.
23
23
24
24
## Set up a Log Analytics workspace
25
25
26
-
If you don't have a Log Analytics workspace, create one by reviewing the methods that are suggested in the [Prerequisites](vminsights-enable-overview.md#log-analytics) section before proceeding with the steps to configure it in order to complete the deployment of Azure Monitor for VMs using the Azure Resource Manager template method.
26
+
If you don't have a Log Analytics workspace, you need to create one. Review the methods that are suggested in the [Prerequisites](vminsights-enable-overview.md#log-analytics) section before you continue with the steps to configure it. Then you can finish the deployment of Azure Monitor for VMs by using the Azure Resource Manager template method.
27
27
28
28
### Enable performance counters
29
29
30
-
If the Log Analytics workspace that's referenced by the solution isn't already configured to collect the performance counters required by the solution, you need to enable them. You can do so in either of two ways:
30
+
If the Log Analytics workspace that's referenced by the solution isn't already configured to collect the performance counters required by the solution, you need to enable them. You can do so in one of two ways:
31
31
* Manually, as described in [Windows and Linux performance data sources in Log Analytics](../../azure-monitor/platform/data-sources-performance-counters.md)
32
-
* By downloading and running a PowerShell script that's available from [Azure PowerShell Gallery](https://www.powershellgallery.com/packages/Enable-VMInsightsPerfCounters/1.1)
32
+
* By downloading and running a PowerShell script that's available from the [Azure PowerShell Gallery](https://www.powershellgallery.com/packages/Enable-VMInsightsPerfCounters/1.1)
33
33
34
34
### Install the ServiceMap and InfrastructureInsights solutions
35
35
This method includes a JSON template that specifies the configuration for enabling the solution components in your Log Analytics workspace.
36
36
37
-
If you're unfamiliar with deploying resources by using a template, see:
37
+
If you don't know how to deploy resources by using a template, see:
38
38
*[Deploy resources with Resource Manager templates and Azure PowerShell](../../azure-resource-manager/resource-group-template-deploy.md)
39
39
*[Deploy resources with Resource Manager templates and the Azure CLI](../../azure-resource-manager/resource-group-template-deploy-cli.md)
40
40
41
-
If you choose to use the Azure CLI, you first need to install and use the CLI locally. You must be running the Azure CLI version 2.0.27 or later. To identify your version, run `az --version`. If you need to install or upgrade the Azure CLI, see [Install the Azure CLI](https://docs.microsoft.com/cli/azure/install-azure-cli).
41
+
To use the Azure CLI, you first need to install and use the CLI locally. You must be running the Azure CLI version 2.0.27 or later. To identify your version, run `az --version`. To install or upgrade the Azure CLI, see [Install the Azure CLI](https://docs.microsoft.com/cli/azure/install-azure-cli).
42
42
43
43
1. Copy and paste the following JSON syntax into your file:
44
44
@@ -116,7 +116,7 @@ If you choose to use the Azure CLI, you first need to install and use the CLI lo
The configuration change can take a few minutes to complete. When it's complete, a message is displayed that's similar to the following and includes the result:
119
+
The configuration change can take a few minutes to finish. When it's finished, a message displays that's similar to the following and includes the result:
120
120
121
121
```powershell
122
122
provisioningState : Succeeded
@@ -130,70 +130,76 @@ If you choose to use the Azure CLI, you first need to install and use the CLI lo
130
130
az group deployment create --name DeploySolutions --resource-group <ResourceGroupName> --template-file InstallSolutionsForVMInsights.json --parameters WorkspaceName=<workspaceName> WorkspaceLocation=<WorkspaceLocation - example: eastus>
131
131
```
132
132
133
-
The configuration change can take a few minutes to complete. When it's completed, a message is displayed that's similar to the following and includes the result:
133
+
The configuration change can take a few minutes to finish. When it's finished, a message is displayed that's similar to the following and includes the result:
134
134
135
-
```azurecli
136
-
provisioningState : Succeeded
137
-
```
135
+
```azurecli
136
+
provisioningState : Succeeded
137
+
```
138
138
139
-
## Enable with Azure Resource Manager template
140
-
We have created example Azure Resource Manager templates for onboarding your virtual machines and virtual machine scale sets. These templates include scenarios for enabling monitoring on an existing resource and for creating a new resource that will have monitoring enabled.
139
+
## Enable with Azure Resource Manager templates
140
+
We have created example Azure Resource Manager templates for onboarding your virtual machines and virtual machine scale sets. These templates include scenarios you can use to enable monitoring on an existing resource and create a new resource that has monitoring enabled.
141
141
142
142
>[!NOTE]
143
-
>The template needs to be deployed in the same resource group as the resource to be onboarded.
143
+
>The template needs to be deployed in the same resource group as the resource to be brought on board.
144
144
145
-
If you are unfamiliar with the concept of deploying resources by using a template, see:
145
+
If you don't know how to deploy resources by using a template, see:
146
146
* [Deploy resources with Resource Manager templates and Azure PowerShell](../../azure-resource-manager/resource-group-template-deploy.md)
147
147
* [Deploy resources with Resource Manager templates and the Azure CLI](../../azure-resource-manager/resource-group-template-deploy-cli.md)
148
148
149
-
If you choose to use the Azure CLI, you first need to install and use the CLI locally. You must be running the Azure CLI version 2.0.27 or later. To identify your version, run `az --version`. If you need to install or upgrade the Azure CLI, see [Install the Azure CLI](https://docs.microsoft.com/cli/azure/install-azure-cli).
149
+
To use the Azure CLI, you first need to install and use the CLI locally. You must be running the Azure CLI version 2.0.27 or later. To identify your version, run `az --version`. To install or upgrade the Azure CLI, see [Install the Azure CLI](https://docs.microsoft.com/cli/azure/install-azure-cli).
150
150
151
151
### Download templates
152
152
153
-
The Azure Resource Manager templates are provided in an archive file (.zip) that you can [download](https://aka.ms/VmInsightsARMTemplates) from our GitHub repo. Contents of the file include folders representing each deployment scenario with a template and parameter file. Before running, modify the parameters file and specify the values required. Do not modify the template file unless you need to customize it to support your particular requirements. After you have modified the parameter file you can deploy it using the following methods described later in this article.
153
+
The Azure Resource Manager templates are provided in an archive file (.zip) that you can [download](https://aka.ms/VmInsightsARMTemplates) from our GitHub repo. Contents of the file include folders that represent each deployment scenario with a template and parameter file. Before you run them, modify the parameters file and specify the values required. Don't modify the template file unless you need to customize it to support your particular requirements. After you have modified the parameter file, you can deploy it by using the following methods described later in this article.
154
154
155
155
The download file contains the following templates for different scenarios:
156
156
157
-
-**ExistingVmOnboarding** template enables Azure Monitor for VMs if the virtual machines already exists.
157
+
- **ExistingVmOnboarding** template enables Azure Monitor for VMs if the virtual machine already exists.
158
158
- **NewVmOnboarding** template creates a virtual machine and enables Azure Monitor for VMs to monitor it.
159
159
- **ExistingVmssOnboarding** template enables Azure Monitor for VMs if the virtual machine scale set already exists.
160
-
-**NewVmssOnboarding** template creates a virtual machine scale sets and enables Azure Monitor for VMs to monitor them.
161
-
-**ConfigureWorksapce*** template configures your Log Analytics workspace to support Azure Monitor for VMs by enabling the solutions and collection of Linux and Windows operating system performance counters.
160
+
- **NewVmssOnboarding** template creates virtual machine scale sets and enables Azure Monitor for VMs to monitor them.
161
+
- **ConfigureWorksapce** template configures your Log Analytics workspace to support Azure Monitor for VMs by enabling the solutions and collection of Linux and Windows operating system performance counters.
162
162
163
163
>[!NOTE]
164
-
>If virtual machine scale sets were already present and the upgrade policy is set to **Manual**, Azure Monitor for VMs will not be enabled for instances by default after running the **ExistingVmssOnboarding** Azure Resource Manager template. You have to manually upgrade the instances.
164
+
>If virtual machine scale sets were already present and the upgrade policy is set to **Manual**, Azure Monitor for VMs won't be enabled for instances by default after running the **ExistingVmssOnboarding** Azure Resource Manager template. You have to manually upgrade the instances.
165
165
166
-
### Deploy using Azure PowerShell
166
+
### Deploy by using Azure PowerShell
167
167
168
-
The following step enables monitoring using Azure PowerShell.
168
+
The following step enables monitoring by using Azure PowerShell.
The configuration change can take a few minutes to complete. When it's completed, a message is displayed that's similar to the following and includes the result:
173
+
The configuration change can take a few minutes to finish. When it's finished, a message displays that's similar to the following and includes the result:
174
174
175
175
```powershell
176
176
provisioningState : Succeeded
177
177
```
178
-
### Deploy using Azure CLI
178
+
### Deploy by using the Azure CLI
179
179
180
-
The following step enables monitoring using Azure CLI.
180
+
The following step enables monitoring by using the Azure CLI.
181
181
182
182
```azurecli
183
183
az login
184
184
az account set --subscription "Subscription Name"
185
185
az group deployment create --resource-group <ResourceGroupName> --template-file <Template.json> --parameters <Parameters.json>
186
186
```
187
187
188
-
The output will resemble the following:
188
+
The output resembles the following:
189
189
190
190
```azurecli
191
191
provisioningState : Succeeded
192
192
```
193
193
194
194
## Enable with PowerShell
195
195
196
-
To enable Azure Monitor for VMs for multiple VMs or virtual machine scale sets, you can use the PowerShell script [Install-VMInsights.ps1](https://www.powershellgallery.com/packages/Install-VMInsights/1.0), available from the Azure PowerShell Gallery. This script iterates through every virtual machine and virtual machine scale set in your subscription, in the scoped resource group that's specified by *ResourceGroup*, or to a single VM or virtual machine scale set that's specified by *Name*. For each VM or virtual machine scale set, the script verifies whether the VM extension is already installed. If the VM extension is not installed, the script tries to reinstall it. If the VM extension is installed, the script installs the Log Analytics and Dependency agent VM extensions.
196
+
To enable Azure Monitor for VMs for multiple VMs or virtual machine scale sets, use the PowerShell script [Install-VMInsights.ps1](https://www.powershellgallery.com/packages/Install-VMInsights/1.0). It's available from the Azure PowerShell Gallery. This script iterates through:
197
+
198
+
- Every virtual machine and virtual machine scale set in your subscription.
199
+
- The scoped resource group that's specified by *ResourceGroup*.
200
+
- A single VM or virtual machine scale set that's specified by *Name*.
201
+
202
+
For each VM or virtual machine scale set, the script verifies whether the VM extension is already installed. If the VM extension isn't installed, the script tries to reinstall it. If the VM extension is installed, the script installs the Log Analytics and Dependency agent VM extensions.
197
203
198
204
This script requires Azure PowerShell module Az version 1.0.0 or later. Run `Get-Module -ListAvailable Az` to find the version. If you need to upgrade, see [Install Azure PowerShell module](https://docs.microsoft.com/powershell/azure/install-az-ps). If you're running PowerShell locally, you also need to run `Connect-AzAccount` to create a connection with Azure.
199
205
@@ -213,23 +219,23 @@ SYNTAX
213
219
214
220
215
221
DESCRIPTION
216
-
This script installs or re-configures following on VMs and VM Scale Sets:
217
-
- Log Analytics VM Extension configured to supplied Log Analytics Workspace
218
-
- Dependency Agent VM Extension
222
+
This script installs or reconfigures the following on VMs and virtual machine scale sets:
223
+
- Log Analytics VM extension configured to supplied Log Analytics workspace
224
+
- Dependency agent VM extension
219
225
220
226
Can be applied to:
221
227
- Subscription
222
-
- Resource Group in a Subscription
223
-
- Specific VM/VM Scale Set
224
-
- Compliance results of a policy for a VM or VM Extension
228
+
- Resource group in a subscription
229
+
- Specific VM or virtual machine scale set
230
+
- Compliance results of a policy for a VM or VM extension
225
231
226
-
Script will show you list of VMs/VM Scale Sets that will apply to and let you confirm to continue.
232
+
Script will show you a list of VMs or virtual machine scale sets that will apply to and let you confirm to continue.
227
233
Use -Approve switch to run without prompting, if all required parameters are provided.
228
234
229
-
If the extensions are already installed will not install again.
230
-
Use -ReInstall switch if you need to for example update the workspace.
235
+
If the extensions are already installed, they will not install again.
236
+
Use -ReInstall switch if you need to, for example, update the workspace.
231
237
232
-
Use -WhatIf if you would like to see what would happen in terms of installs, what workspace configured to, and status of the extension.
238
+
Use -WhatIf if you want to see what would happen in terms of installs, what workspace configured to, and status of the extension.
Now that monitoring is enabled for your virtual machines, this information is available for analysis with Azure Monitor for VMs. To learn how to use the Health feature, see [View Azure Monitor for VMs Health](vminsights-health.md). To view discovered application dependencies, see [View Azure Monitor for VMs Map](vminsights-maps.md). To identify bottlenecks and overall utilization with your VMs performance, see [View Azure VM Performance](vminsights-performance.md), or to view discovered application dependencies, see [View Azure Monitor for VMs Map](vminsights-maps.md).
359
+
Now that monitoring is enabled for your virtual machines, this information is available for analysis with Azure Monitor for VMs.
360
+
361
+
- To learn how to use the health feature, see [View Azure Monitor for VMs health](vminsights-health.md).
362
+
- To view discovered application dependencies, see [View Azure Monitor for VMs Map](vminsights-maps.md).
363
+
- To identify bottlenecks and overall utilization with your VM's performance, see [View Azure VM Performance](vminsights-performance.md).
364
+
- To view discovered application dependencies, see [View Azure Monitor for VMs Map](vminsights-maps.md).
0 commit comments