Skip to content

Commit 5123ab7

Browse files
authored
Merge pull request #206161 from hestolz/main
Azure Monitor Agent UAI instructions
2 parents 4096064 + 0e66236 commit 5123ab7

File tree

2 files changed

+273
-36
lines changed

2 files changed

+273
-36
lines changed

articles/azure-monitor/agents/azure-monitor-agent-manage.md

Lines changed: 55 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,11 @@ The Azure Monitor agent is implemented as an [Azure VM extension](../../virtual-
2020
|:---|:---|:---|
2121
| Publisher | Microsoft.Azure.Monitor | Microsoft.Azure.Monitor |
2222
| Type | AzureMonitorWindowsAgent | AzureMonitorLinuxAgent |
23-
| TypeHandlerVersion | 1.2 | 1.15 |
23+
| TypeHandlerVersion | See [Azure Monitor Agent extension versions](./azure-monitor-agent-extension-versions.md) | [Azure Monitor Agent extension versions](./azure-monitor-agent-extension-versions.md) |
2424

2525
## Extension versions
2626
[View Azure Monitor Agent extension versions](./azure-monitor-agent-extension-versions.md).
2727

28-
2928
## Prerequisites
3029
The following prerequisites must be met prior to installing the Azure Monitor agent.
3130

@@ -37,7 +36,18 @@ The following prerequisites must be met prior to installing the Azure Monitor ag
3736
| Any role that includes the action *Microsoft.Resources/deployments/** | <ul><li>Subscription and/or</li><li>Resource group and/or </li></ul> | To deploy ARM templates |
3837
- **Non-Azure**: For installing the agent on physical servers and virtual machines hosted *outside* of Azure (i.e. on-premises) or in other clouds, you must [install the Azure Arc Connected Machine agent](../../azure-arc/servers/agent-overview.md) first (at no added cost)
3938
- **Authentication**: [Managed identity](../../active-directory/managed-identities-azure-resources/overview.md) must be enabled on Azure virtual machines. Both system-assigned and user-assigned managed identities are supported.
40-
- **User-assigned**: This is recommended for large scale deployments, configurable via [built-in Azure policies](#using-azure-policy). It can be created once and shared across multiple VMs, and is thus more scalable than system-assigned.
39+
- **User-assigned**: This is recommended for large-scale deployments, configurable via [built-in Azure policies](#using-azure-policy). You can create a user-assigned managed identity once and share it across multiple VMs, and is thus more scalable than a system-assigned managed identity. If you use a user-assigned managed identity, you must pass the managed identity details to Azure Monitor Agent via extension settings:
40+
```json
41+
{
42+
"authentication": {
43+
"managedIdentity": {
44+
"identifier-name": "mi_res_id" or "object_id" or "client_id",
45+
"identifier-value": "<resource-id-of-uai>" or "<guid-object-or-client-id>"
46+
}
47+
}
48+
}
49+
```
50+
We recommend using `mi_res_id` as the `identifier-name`. The sample commands below only show usage with `mi_res_id` for the sake of brevity. For more details on `mi_res_id`, `object_id`, and `client_id`, see the [managed identity documentation](../../active-directory/managed-identities-azure-resources/how-to-use-vm-token.md#get-a-token-using-http).
4151
- **System-assigned**: This is suited for initial testing or small deployments. When used at scale (for example, for all VMs in a subscription) it results in substantial number of identities created (and deleted) in Azure AD (Azure Active Directory). To avoid this churn of identities, it is recommended to use user-assigned managed identities instead. **For Arc-enabled servers, system-assigned managed identity is enabled automatically** (as soon as you install the Arc agent) as it's the only supported type for Arc-enabled servers.
4252
- This is not required for Azure Arc-enabled servers. The system identity will be enabled automatically if the agent is installed via [creating and assigning a data collection rule using the Azure portal](data-collection-rule-azure-monitor-agent.md#create-data-collection-rule-and-association).
4353
- **Networking**: The [AzureResourceManager service tag](../../virtual-network/service-tags-overview.md) must be enabled on the virtual network for the virtual machine. Additionally, the virtual machine must have access to the following HTTPS endpoints:
@@ -64,7 +74,7 @@ To uninstall the Azure Monitor agent using the Azure portal, navigate to your vi
6474
To perform a **one time update** of the agent, you must first uninstall the existing agent version and then install the new version as described above.
6575
The **recommendation** is to enable automatic update of the agent by enabling the [Automatic Extension Upgrade](../../virtual-machines/automatic-extension-upgrade.md) feature. Navigate to your virtual machine or scale set, select the **Extensions** tab and click on **AzureMonitorWindowsAgent** or **AzureMonitorLinuxAgent**. In the dialog that pops up, click **Enable automatic upgrade**.
6676

67-
## Using Resource Manager template
77+
## Using Resource Manager templates
6878

6979
### Install
7080
You can use Resource Manager templates to install the Azure Monitor agent on Azure virtual machines and on Azure Arc-enabled servers and to create an association with data collection rules. You must create any data collection rule prior to creating the association.
@@ -81,35 +91,48 @@ Install the templates using [any deployment method for Resource Manager template
8191
New-AzResourceGroupDeployment -ResourceGroupName "<resource-group-name>" -TemplateFile "<template-filename.json>" -TemplateParameterFile "<parameter-filename.json>"
8292
```
8393
# [CLI](#tab/ARMAgentCLI)
84-
```powershell
85-
New-AzResourceGroupDeployment -ResourceGroupName "<resource-group-name>" -TemplateFile "<template-filename.json>" -TemplateParameterFile "<parameter-filename.json>"
94+
```azurecli
95+
az deployment group create --resource-group "<resource-group-name>" --template-file "<path-to-template>" --parameters "@<parameter-filename.json>"
8696
```
8797
---
8898

8999
## Using PowerShell
90100
You can install the Azure Monitor agent on Azure virtual machines and on Azure Arc-enabled servers using the PowerShell command for adding a virtual machine extension.
91101

92102
### Install on Azure virtual machines
93-
Use the following PowerShell commands to install the Azure Monitor agent on Azure virtual machines.
103+
Use the following PowerShell commands to install the Azure Monitor agent on Azure virtual machines. Choose the appropriate command based on your chosen authentication method.
104+
105+
#### User-assigned managed identity
94106
# [Windows](#tab/PowerShellWindows)
95107
```powershell
96-
Set-AzVMExtension -Name AMAWindows -ExtensionType AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Location <location> -TypeHandlerVersion <version-number>
108+
Set-AzVMExtension -Name AzureMonitorWindowsAgent -ExtensionType AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Location <location> -TypeHandlerVersion <version-number> -SettingString '{"authentication":{"managedIdentity":{"identifier-name":"mi_res_id","identifier-value":/subscriptions/<my-subscription-id>/resourceGroups/<my-resource-group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<my-user-assigned-identity>"}}}'
97109
```
98110
# [Linux](#tab/PowerShellLinux)
99111
```powershell
100-
Set-AzVMExtension -Name AMALinux -ExtensionType AzureMonitorLinuxAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Location <location> -TypeHandlerVersion <version-number>
112+
Set-AzVMExtension -Name AzureMonitorLinuxAgent -ExtensionType AzureMonitorLinuxAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Location <location> -TypeHandlerVersion <version-number> -SettingString '{"authentication":{"managedIdentity":{"identifier-name":"mi_res_id","identifier-value":/subscriptions/<my-subscription-id>/resourceGroups/<my-resource-group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<my-user-assigned-identity>"}}}'
113+
```
114+
---
115+
116+
#### System-assigned managed identity
117+
# [Windows](#tab/PowerShellWindows)
118+
```powershell
119+
Set-AzVMExtension -Name AzureMonitorWindowsAgent -ExtensionType AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Location <location> -TypeHandlerVersion <version-number>
120+
```
121+
# [Linux](#tab/PowerShellLinux)
122+
```powershell
123+
Set-AzVMExtension -Name AzureMonitorLinuxAgent -ExtensionType AzureMonitorLinuxAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Location <location> -TypeHandlerVersion <version-number>
101124
```
102125
---
103126

104127
### Uninstall on Azure virtual machines
105128
Use the following PowerShell commands to install the Azure Monitor agent on Azure virtual machines.
106129
# [Windows](#tab/PowerShellWindows)
107130
```powershell
108-
Remove-AzVMExtension -Name AMAWindows -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name>
131+
Remove-AzVMExtension -Name AzureMonitorWindowsAgent -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name>
109132
```
110133
# [Linux](#tab/PowerShellLinux)
111134
```powershell
112-
Remove-AzVMExtension -Name AMALinux -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name>
135+
Remove-AzVMExtension -Name AzureMonitorLinuxAgent -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name>
113136
```
114137
---
115138

@@ -118,11 +141,11 @@ To perform a **one time update** of the agent, you must first uninstall the exis
118141
The **recommendation** is to enable automatic update of the agent by enabling the [Automatic Extension Upgrade](../../virtual-machines/automatic-extension-upgrade.md) feature, using the following PowerShell commands.
119142
# [Windows](#tab/PowerShellWindows)
120143
```powershell
121-
Set-AzVMExtension -ExtensionName AMAWindows -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Publisher Microsoft.Azure.Monitor -ExtensionType AzureMonitorWindowsAgent -TypeHandlerVersion <version-number> -Location <location> -EnableAutomaticUpgrade $true
144+
Set-AzVMExtension -ExtensionName AzureMonitorWindowsAgent -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Publisher Microsoft.Azure.Monitor -ExtensionType AzureMonitorWindowsAgent -TypeHandlerVersion <version-number> -Location <location> -EnableAutomaticUpgrade $true
122145
```
123146
# [Linux](#tab/PowerShellLinux)
124147
```powershell
125-
Set-AzVMExtension -ExtensionName AMALinux -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Publisher Microsoft.Azure.Monitor -ExtensionType AzureMonitorLinuxAgent -TypeHandlerVersion <version-number> -Location <location> -EnableAutomaticUpgrade $true
148+
Set-AzVMExtension -ExtensionName AzureMonitorLinuxAgent -ResourceGroupName <resource-group-name> -VMName <virtual-machine-name> -Publisher Microsoft.Azure.Monitor -ExtensionType AzureMonitorLinuxAgent -TypeHandlerVersion <version-number> -Location <location> -EnableAutomaticUpgrade $true
126149
```
127150
---
128151

@@ -131,23 +154,23 @@ Set-AzVMExtension -ExtensionName AMALinux -ResourceGroupName <resource-group-nam
131154
Use the following PowerShell commands to install the Azure Monitor agent on Azure Arc-enabled servers.
132155
# [Windows](#tab/PowerShellWindowsArc)
133156
```powershell
134-
New-AzConnectedMachineExtension -Name AMAWindows -ExtensionType AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -MachineName <arc-server-name> -Location <arc-server-location>
157+
New-AzConnectedMachineExtension -Name AzureMonitorWindowsAgent -ExtensionType AzureMonitorWindowsAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -MachineName <arc-server-name> -Location <arc-server-location>
135158
```
136159
# [Linux](#tab/PowerShellLinuxArc)
137160
```powershell
138-
New-AzConnectedMachineExtension -Name AMALinux -ExtensionType AzureMonitorLinuxAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -MachineName <arc-server-name> -Location <arc-server-location>
161+
New-AzConnectedMachineExtension -Name AzureMonitorLinuxAgent -ExtensionType AzureMonitorLinuxAgent -Publisher Microsoft.Azure.Monitor -ResourceGroupName <resource-group-name> -MachineName <arc-server-name> -Location <arc-server-location>
139162
```
140163
---
141164

142165
### Uninstall on Azure Arc-enabled servers
143166
Use the following PowerShell commands to install the Azure Monitor agent on Azure Arc-enabled servers.
144167
# [Windows](#tab/PowerShellWindowsArc)
145168
```powershell
146-
Remove-AzConnectedMachineExtension -MachineName <arc-server-name> -ResourceGroupName <resource-group-name> -Name AMAWindows
169+
Remove-AzConnectedMachineExtension -MachineName <arc-server-name> -ResourceGroupName <resource-group-name> -Name AzureMonitorWindowsAgent
147170
```
148171
# [Linux](#tab/PowerShellLinuxArc)
149172
```powershell
150-
Remove-AzConnectedMachineExtension -MachineName <arc-server-name> -ResourceGroupName <resource-group-name> -Name AMALinux
173+
Remove-AzConnectedMachineExtension -MachineName <arc-server-name> -ResourceGroupName <resource-group-name> -Name AzureMonitorLinuxAgent
151174
```
152175
---
153176

@@ -169,11 +192,11 @@ Update-AzConnectedExtension -ResourceGroupName $env.ResourceGroupName -MachineNa
169192
The **recommendation** is to enable automatic update of the agent by enabling the [Automatic Extension Upgrade (preview)](../../azure-arc/servers/manage-automatic-vm-extension-upgrade.md#enable-automatic-extension-upgrade) feature, using the following PowerShell commands.
170193
# [Windows](#tab/PowerShellWindowsArc)
171194
```powershell
172-
Update-AzConnectedMachineExtension -ResourceGroup <resource-group-name> -MachineName <arc-server-name> -Name AMAWindows -EnableAutomaticUpgrade
195+
Update-AzConnectedMachineExtension -ResourceGroup <resource-group-name> -MachineName <arc-server-name> -Name AzureMonitorWindowsAgent -EnableAutomaticUpgrade
173196
```
174197
# [Linux](#tab/PowerShellLinuxArc)
175198
```powershell
176-
Update-AzConnectedMachineExtension -ResourceGroup <resource-group-name> -MachineName <arc-server-name> -Name AMALinux -EnableAutomaticUpgrade
199+
Update-AzConnectedMachineExtension -ResourceGroup <resource-group-name> -MachineName <arc-server-name> -Name AzureMonitorLinuxAgent -EnableAutomaticUpgrade
177200
```
178201
---
179202

@@ -182,7 +205,19 @@ Update-AzConnectedMachineExtension -ResourceGroup <resource-group-name> -Machine
182205
You can install the Azure Monitor agent on Azure virtual machines and on Azure Arc-enabled servers using the Azure CLI command for adding a virtual machine extension.
183206

184207
### Install on Azure virtual machines
185-
Use the following CLI commands to install the Azure Monitor agent on Azure virtual machines.
208+
Use the following CLI commands to install the Azure Monitor agent on Azure virtual machines. Choose the appropriate command based on your chosen authentication method.
209+
#### User-assigned managed identity
210+
# [Windows](#tab/CLIWindows)
211+
```azurecli
212+
az vm extension set --name AzureMonitorWindowsAgent --publisher Microsoft.Azure.Monitor --ids <vm-resource-id> --settings '{"authentication":{"managedIdentity":{"identifier-name":"mi_res_id","identifier-value":/subscriptions/<my-subscription-id>/resourceGroups/<my-resource-group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<my-user-assigned-identity>"}}}'
213+
```
214+
# [Linux](#tab/CLILinux)
215+
```azurecli
216+
az vm extension set --name AzureMonitorLinuxAgent --publisher Microsoft.Azure.Monitor --ids <vm-resource-id> --settings '{"authentication":{"managedIdentity":{"identifier-name":"mi_res_id","identifier-value":/subscriptions/<my-subscription-id>/resourceGroups/<my-resource-group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<my-user-assigned-identity>"}}}'
217+
```
218+
---
219+
220+
#### System-assigned managed identity
186221
# [Windows](#tab/CLIWindows)
187222
```azurecli
188223
az vm extension set --name AzureMonitorWindowsAgent --publisher Microsoft.Azure.Monitor --ids <vm-resource-id>

0 commit comments

Comments
 (0)