Microsoft
AZ-204 · Question #637
You have 100 Azure virtual machines (VMs) with the system-assigned managed identity enabled. You need to identify the value of the object ID attribute for each of the identities. Which command should
The correct answer is D. az resource show. az resource show Get-AzResource az ad signed-in-user list-owned-objects az ad sp credential list az ad user show Get-AzureADUser Get-AzureADUserOwnedObject Get-AzResource For a system-assigned managed identity, you can find the object ID on the Azure portal on the resource's Iden
Submitted by akirajp· Mar 30, 2026Implement Azure security
Question
You have 100 Azure virtual machines (VMs) with the system-assigned managed identity enabled. You need to identify the value of the object ID attribute for each of the identities. Which command should you use?
Options
- AGet-AzVM
- BGet-AzureADUserOwnedObject
- Caz ad sp credential list
- Daz resource show
How the community answered
(30 responses)- A13% (4)
- B3% (1)
- C7% (2)
- D77% (23)
Explanation
- az resource show * Get-AzResource * az ad signed-in-user list-owned-objects * az ad sp credential list * az ad user show * Get-AzureADUser Get-AzureADUserOwnedObject * Get-AzResource For a system-assigned managed identity, you can find the object ID on the Azure portal on the resource's Identity page. You can also use the following PowerShell script to find the object ID. You'll need the resource ID of the resource. $resourceIdWithManagedIdentity = '/subscriptions/{my subscription ID}/resourceGroups/{my resource group name}/providers/Microsoft.Compute/virtualMachines/{my virtual machine name}' (Get-AzResource -ResourceId $resourceIdWithManagedIdentity).Identity.PrincipalId 1* az resource show You can also use the following script to find the object ID. You'll need the resource ID of the resource you created. resourceIdWithManagedIdentity="/subscriptions/{my subscription ID}/resourceGroups/{my resource group name}/providers/Microsoft.Compute/virtualMachines/{my virtual machine name}" oidForMI=$(az resource show --ids $resourceIdWithManagedIdentity --query "identity.principalId" -o tsv | tr -d '[:space:]') echo "object id for managed identity is: $oidForMI" https://learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/how-to- assign-app-role-managed-identity
Topics
#managed identity#system-assigned identity#object ID#az CLI
Community Discussion
No community discussion yet for this question.