Skip to content

Commit 4351e9e

Browse files
Merge pull request #79217 from paulth1/vminsights-enable-at-scale-powershell
edit pass: vminsights-enable-at-scale-powershell
2 parents db46a37 + 2684b95 commit 4351e9e

File tree

1 file changed

+61
-50
lines changed

1 file changed

+61
-50
lines changed

articles/azure-monitor/insights/vminsights-enable-at-scale-powershell.md

Lines changed: 61 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
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.
44
services: azure-monitor
55
documentationcenter: ''
66
author: mgoedtel
@@ -15,30 +15,30 @@ ms.date: 05/09/2019
1515
ms.author: magoedte
1616
---
1717

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
1919

2020
[!INCLUDE [updated-for-az](../../../includes/updated-for-az.md)]
2121

22-
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.
2323

2424
## Set up a Log Analytics workspace
2525

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.
2727

2828
### Enable performance counters
2929

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:
3131
* 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)
3333

3434
### Install the ServiceMap and InfrastructureInsights solutions
3535
This method includes a JSON template that specifies the configuration for enabling the solution components in your Log Analytics workspace.
3636

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:
3838
* [Deploy resources with Resource Manager templates and Azure PowerShell](../../azure-resource-manager/resource-group-template-deploy.md)
3939
* [Deploy resources with Resource Manager templates and the Azure CLI](../../azure-resource-manager/resource-group-template-deploy-cli.md)
4040

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).
4242

4343
1. Copy and paste the following JSON syntax into your file:
4444

@@ -116,7 +116,7 @@ If you choose to use the Azure CLI, you first need to install and use the CLI lo
116116
New-AzResourceGroupDeployment -Name DeploySolutions -TemplateFile InstallSolutionsForVMInsights.json -ResourceGroupName <ResourceGroupName> -WorkspaceName <WorkspaceName> -WorkspaceLocation <WorkspaceLocation - example: eastus>
117117
```
118118

119-
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:
120120

121121
```powershell
122122
provisioningState : Succeeded
@@ -130,70 +130,76 @@ If you choose to use the Azure CLI, you first need to install and use the CLI lo
130130
az group deployment create --name DeploySolutions --resource-group <ResourceGroupName> --template-file InstallSolutionsForVMInsights.json --parameters WorkspaceName=<workspaceName> WorkspaceLocation=<WorkspaceLocation - example: eastus>
131131
```
132132

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:
134134

135-
```azurecli
136-
provisioningState : Succeeded
137-
```
135+
```azurecli
136+
provisioningState : Succeeded
137+
```
138138

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.
141141

142142
>[!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.
144144

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:
146146
* [Deploy resources with Resource Manager templates and Azure PowerShell](../../azure-resource-manager/resource-group-template-deploy.md)
147147
* [Deploy resources with Resource Manager templates and the Azure CLI](../../azure-resource-manager/resource-group-template-deploy-cli.md)
148148

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).
150150

151151
### Download templates
152152

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.
154154

155155
The download file contains the following templates for different scenarios:
156156

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.
158158
- **NewVmOnboarding** template creates a virtual machine and enables Azure Monitor for VMs to monitor it.
159159
- **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.
162162

163163
>[!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.
165165

166-
### Deploy using Azure PowerShell
166+
### Deploy by using Azure PowerShell
167167

168-
The following step enables monitoring using Azure PowerShell.
168+
The following step enables monitoring by using Azure PowerShell.
169169

170170
```powershell
171171
New-AzResourceGroupDeployment -Name OnboardCluster -ResourceGroupName <ResourceGroupName> -TemplateFile <Template.json> -TemplateParameterFile <Parameters.json>
172172
```
173-
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:
174174

175175
```powershell
176176
provisioningState : Succeeded
177177
```
178-
### Deploy using Azure CLI
178+
### Deploy by using the Azure CLI
179179

180-
The following step enables monitoring using Azure CLI.
180+
The following step enables monitoring by using the Azure CLI.
181181

182182
```azurecli
183183
az login
184184
az account set --subscription "Subscription Name"
185185
az group deployment create --resource-group <ResourceGroupName> --template-file <Template.json> --parameters <Parameters.json>
186186
```
187187

188-
The output will resemble the following:
188+
The output resembles the following:
189189

190190
```azurecli
191191
provisioningState : Succeeded
192192
```
193193

194194
## Enable with PowerShell
195195

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.
197203

198204
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.
199205

@@ -213,23 +219,23 @@ SYNTAX
213219
214220
215221
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
219225
220226
Can be applied to:
221227
- 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
225231
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.
227233
Use -Approve switch to run without prompting, if all required parameters are provided.
228234
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.
231237
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.
233239
234240
235241
PARAMETERS
@@ -284,19 +290,19 @@ PARAMETERS
284290
.\Install-VMInsights.ps1 -WorkspaceRegion eastus -WorkspaceId <WorkspaceId>-WorkspaceKey <WorkspaceKey> -SubscriptionId <SubscriptionId>
285291
-ResourceGroup <ResourceGroup>
286292
287-
Install for all VMs in a Resource Group in a subscription
293+
Install for all VMs in a resource group in a subscription
288294
289295
-------------------------- EXAMPLE 2 --------------------------
290296
.\Install-VMInsights.ps1 -WorkspaceRegion eastus -WorkspaceId <WorkspaceId>-WorkspaceKey <WorkspaceKey> -SubscriptionId <SubscriptionId>
291297
-ResourceGroup <ResourceGroup> -ReInstall
292298
293-
Specify to reinstall extensions even if already installed, for example to update to a different workspace
299+
Specify to reinstall extensions even if already installed, for example, to update to a different workspace
294300
295301
-------------------------- EXAMPLE 3 --------------------------
296302
.\Install-VMInsights.ps1 -WorkspaceRegion eastus -WorkspaceId <WorkspaceId>-WorkspaceKey <WorkspaceKey> -SubscriptionId <SubscriptionId>
297303
-PolicyAssignmentName a4f79f8ce891455198c08736 -ReInstall
298304
299-
Specify to use a PolicyAssignmentName for source, and to reinstall (move to a new workspace)
305+
Specify to use a PolicyAssignmentName for source and to reinstall (move to a new workspace)
300306
```
301307

302308
The following example demonstrates using the PowerShell commands in the folder to enable Azure Monitor for VMs and understand the expected output:
@@ -307,16 +313,16 @@ $WorkspaceKey = "<Key>"
307313
$SubscriptionId = "<GUID>"
308314
.\Install-VMInsights.ps1 -WorkspaceId $WorkspaceId -WorkspaceKey $WorkspaceKey -SubscriptionId $SubscriptionId -WorkspaceRegion eastus
309315
310-
Getting list of VMs or VM ScaleSets matching criteria specified
316+
Getting list of VMs or virtual machine scale sets matching criteria specified
311317
312-
VMs or VM ScaleSets matching criteria:
318+
VMs or virtual machine scale sets matching criteria:
313319
314320
db-ws-1 VM running
315321
db-ws2012 VM running
316322
317-
This operation will install the Log Analytics and Dependency agent extensions on above 2 VMs or VM Scale Sets.
323+
This operation will install the Log Analytics and Dependency agent extensions on the previous two VMs or virtual machine scale sets.
318324
VMs in a non-running state will be skipped.
319-
Extension will not be reinstalled if already installed. Use -ReInstall if desired, for example to update workspace
325+
Extension will not be reinstalled if already installed. Use -ReInstall if desired, for example, to update workspace.
320326
321327
Confirm
322328
Continue?
@@ -333,7 +339,7 @@ db-ws2012 : Successfully deployed MicrosoftMonitoringAgent
333339
334340
Summary:
335341
336-
Already Onboarded: (0)
342+
Already onboarded: (0)
337343
338344
Succeeded: (4)
339345
db-ws-1 : Successfully deployed DependencyAgentWindows
@@ -350,4 +356,9 @@ Failed: (0)
350356

351357
## Next steps
352358

353-
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

Comments
 (0)