A user-assigned managed identity is a standalone Azure resource that lets multiple Azure resources authenticate to supported cloud services without storing passwords, certificates, or service-principal secrets. section 2.1.5
Use it when:
- Several Azure resources need the same identity for Azure AD-authenticated access. section 2.1.5
- A deployment needs to avoid creating one system-assigned identity per resource. section 9.1.4
- The target Azure service supports managed identities and the identity has been granted appropriate permissions. section 2.1.6
Create the identity in a resource group with Azure Cloud Shell, then assign permissions to the Azure resources it must access. The resulting resource exposes identifiers such as clientId, principalId, tenantId, and its resource ID. section 2.1.6
Shows the Azure CLI command for creating MyManagedIdentity and identifies its name and resource-group arguments. section 2.1.6
Reuse across virtual machines
For Azure Monitor Agent deployments across 100 VMs, one user-assigned identity can be reused instead of creating 100 system-assigned identities. Configure the VM extension with the identity's resource ID. section 9.1.4
Listing 9.1 Installing AMA on Azure VM
az vm extension set –name AzureMonitorWindowsAgent #1 --publisher Microsoft.Azure.Monitor #2 --ids <vm-resource-id> #3 --enable-auto-upgrade true #4 --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>"}}}' #5 #1 The name of the VM extension. To install AMA, the value needs to be AzureMonitorWindowsAgent. #2 The name of the extension publisher #3 One or more of your resource IDs #4 Enables automatic updates of the extension whenever a newer version of the extension is available #5 JSON format with the user-assigned managed identity used to install AMA on the VM
Shows Azure Monitor Agent installation using the user-assigned identity resource ID and enables automatic extension upgrades. section 9.1.4
