CmdID / az / az monitor / az monitor account / az monitor account identity
az monitor account identity assign
Assign the user or system managed identities. Azure CLI reference
2 examples 3 options Its page in the Azure CLI reference
Examples
Assign a system-assigned managed identity to an Azure Monitor workspace
az monitor account identity assign -n myWorkspace -g myRG --system-assignedIdentify-nThe name of the Azure Monitor workspace.-gName of resource group.--system-assignedSet the system managed identity.Assign a user-assigned managed identity to an Azure Monitor workspace
az monitor account identity assign -n myWorkspace -g myRG --user-assigned /subscriptions/sub/resourceGroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentityIdentify-nThe name of the Azure Monitor workspace.-gName of resource group.--user-assignedSet the user managed identities.Options
--azure-monitor-workspace-name, --name, -nThe name of the Azure Monitor workspace.--mi-system-assigned, --system-assignedSet the system managed identity.--mi-user-assigned, --user-assignedSet the user managed identities.