Skip to content

Commit a1c207c

Browse files
committed
fixes
1 parent bf75ce9 commit a1c207c

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

articles/azure-monitor/vm/vminsights-enable-powershell.md

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ You need to:
3131
To enable VM insights for multiple VMs or virtual machine scale set, use the PowerShell script [Install-VMInsights.ps1](https://www.powershellgallery.com/packages/Install-VMInsights). The script is available from the Azure PowerShell Gallery. This script iterates through the virtual machines or virtual machine scale sets according to the parameters that you specify. The script can be used to enable VM insights for:
3232

3333
- Every virtual machine and virtual machine scale set in your subscription.
34-
- The scoped resource group specified by `-ResourceGroup`.
35-
- A single VM or virtual machine scale set specified by `-Name`.
34+
- The scoped resource groups specified by `-ResourceGroup`.
35+
- A VM or virtual machine scale set specified by `-Name`.
36+
You can specify multiple resource groups, VMs, or scale sets by using wildcards.
3637

3738

3839
Verify that you're using Az PowerShell module version 1.0.0 or later with `Enable-AzureRM` compatibility aliases enabled. Run `Get-Module -ListAvailable Az` to find the version. To upgrade, see [Install Azure PowerShell module](/powershell/azure/install-azure-powershell). If you're running PowerShell locally, run `Connect-AzAccount` to create a connection with Azure.
@@ -55,7 +56,7 @@ When you enable VM insights using Azure Monitor Agent, the script associates a D
5556
Install-VMInsights.ps1 -SubscriptionId <SubscriptionId> `
5657
[-ResourceGroup <ResourceGroup>] `
5758
[-ProcessAndDependencies ] `
58-
[-Name <MV or Virtual Machine Scale Set name>] `
59+
[-Name <VM or Virtual Machine Scale Set name>] `
5960
-DcrResourceId <DataCollectionRuleResourceId> `
6061
-UserAssignedManagedIdentityName <UserAssignedIdentityName> `
6162
-UserAssignedManagedIdentityResourceGroup <UserAssignedIdentityResourceGroup>
@@ -64,19 +65,19 @@ Install-VMInsights.ps1 -SubscriptionId <SubscriptionId> `
6465

6566
Required Arguments:
6667
+ `-SubscriptionId <String>` Azure subscription ID.
67-
+ `-DcrResourceId <String> ` Data Collection Rule (DCR) Azure resource ID identifier.
68+
+ `-DcrResourceId <String> ` Data Collection Rule (DCR) Azure resource ID identifier. You can specify DCRs from different subscriptions to the VMs or virtual machine scale sets being enabled with Vm-Insights.
6869
+ `-UserAssignedManagedIdentityResourceGroup <String> ` Name of User Assigned Managed Identity (UAMI) resource group.
6970
+ `-UserAssignedManagedIdentityName <String> ` Name of User Assigned Managed Identity (UAMI).
7071

7172

7273
Optional Arguments:
7374
+ `-ProcessAndDependencies` Set this flag to onboard the Dependency Agent with Azure Monitoring Agent (AMA) settings. If not specified, only the Azure Monitoring Agent (AMA) is onboarded.
74-
+ `- Name <String>` Name of the VM or Virtual Machine Scale Set to be onboarded. If not specified, all VMs and Virtual Machine Scale Set in the subscription or resource group are onboarded.
75-
+ `- 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 Set in the subscription are onboarded.
75+
+ `-Name <String>` Name of the VM or Virtual Machine Scale Set to be onboarded. If not specified, all VMs and Virtual Machine Scale Set in the subscription or resource group are onboarded. Use wildcards to specify multiple VMs or Virtual Machine Scale Sets.
76+
+ `-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 Set in the subscription are onboarded. Use wildcards to specify multiple resource groups.
7677
+ `-PolicyAssignmentName <String>` Only include VMs associated with this policy. When the PolicyAssignmentName parameter is specified, the VMs part of the parameter SubscriptionId are considered.
7778
+ `-TriggerVmssManualVMUpdate [<SwitchParameter>]` Trigger the update of VM instances in a scale set whose upgrade policy is set to Manual.
7879
+ `-WhatIf [<SwitchParameter>]` Get info about expected effect of the commands in the script.
79-
+ `-Confirm [<SwitchParameter>]` Confirm each VM / Virtual Machine Scale Set.
80+
+ `-Confirm [<SwitchParameter>]` Confirm each action in the script.
8081
+ `-Approve [<SwitchParameter>]` Provide the approval for the installation to start with no confirmation prompt for the listed VM's/Virtual Machine Scale Sets.
8182

8283
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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_wildcards).
@@ -140,21 +141,31 @@ Required Arguments:
140141

141142
Optional Arguments:
142143
+ `-ReInstall [<SwitchParameter>]` Trigger removal of existing Log analytics extension and reinstallation to migrate log analytics workspaces with Legacy Agent (Linux) - OMSAgent.
143-
+ `- 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.
144-
+ `- 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.
145-
+ `-PolicyAssignmentName <String>` Only include VMs associated with this policy. When the PolicyAssignmentName parameter is specified, the VMs part of the parameter SubscriptionId are considered.
144+
+ `-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.
145+
+ `- 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.
146+
+ `-PolicyAssignmentName <String>` Only include VMs associated with this policy. When the PolicyAssignmentName parameter is specified, the VMs part of the parameter SubscriptionId are considered.
146147
+ `-TriggerVmssManualVMUpdate [<SwitchParameter>]` Trigger the update of VM instances in a scale set whose upgrade policy is set to Manual.
147148
+ `-WhatIf [<SwitchParameter>]` Get info about expected effect of the commands in the script.
148-
+ `-Confirm [<SwitchParameter>]` Confirm each VM / Virtual Machine Scale Set.
149+
+ `-Confirm [<SwitchParameter>]` Confirm each action in the script.
149150
+ `-Approve [<SwitchParameter>]` Provide the approval for the installation to start with no confirmation prompt for the listed VM's/Virtual Machine Scale Sets.
150151

151152
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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_wildcards).
152153

153154

154-
Example
155-
Install-VMInsights.ps1 -WorkspaceId \<WorkspaceId\> -WorkspaceKey \<WorkspaceKey\> -SubscriptionId \<SubscriptionId\> -ResourceGroup \<ResourceGroup\>
156-
Install-VMInsights.ps1 -WorkspaceId \<WorkspaceId\> -WorkspaceKey \<WorkspaceKey\> -SubscriptionId \<SubscriptionId\> -ResourceGroup \<ResourceGroup\> -ReInstall
157-
155+
Example:
156+
157+
```powershell
158+
Install-VMInsights.ps1 -WorkspaceId \<WorkspaceId\> `
159+
-WorkspaceKey \<WorkspaceKey\> `
160+
-SubscriptionId \<SubscriptionId\> `
161+
-ResourceGroup \<ResourceGroup\>
162+
163+
Install-VMInsights.ps1 -WorkspaceId \<WorkspaceId\> `
164+
-WorkspaceKey \<WorkspaceKey\> `
165+
-SubscriptionId \<SubscriptionId\> `
166+
-ResourceGroup \<ResourceGroup\> `
167+
-ReInstall
168+
```
158169

159170

160171
Use the following command to enable VM insights using Log Analytics Agent and Dependency Agent.

0 commit comments

Comments
 (0)