Why VM log in user not showing as Entra ID user even Role assignments given

Varma 1,620 Reputation points
2026-06-08T05:18:05.7366667+00:00

I provided role assignment "VM log in user " to my virtual machine but still when i do "whoami" it is showing as adminuser. you can see below and please let us know fix for this:

it supposed to show below highlighted role assignment right?

<moving personal details as a safety check to private messages section>

Azure Virtual Machines
Azure Virtual Machines

An Azure service that is used to provision Windows and Linux virtual machines.


1 answer

Sort by: Newest
  1. AI answer

    2026-06-08T05:18:20.4566667+00:00

    whoami in the Linux VM shows the local Linux account name that the SSH session is running under (for example, adminuser). It never shows the Microsoft Entra ID user or the Azure role name.

    The Virtual Machine User Login / Virtual Machine Administrator Login roles are Azure RBAC roles used only to authorize whether a Microsoft Entra user is allowed to sign in to the VM. They do not rename or change the local Linux username, and they are not reflected in whoami output.

    To use Microsoft Entra ID for SSH on Linux and still see a local username, the following must be in place (independent of whoami):

    1. The VM must have a system-assigned managed identity enabled before installing the Microsoft Entra login extension; otherwise the extension installation fails with non-zero exit codes and sign-in will not work.
    2. The AADSSHLoginForLinux (or equivalent) extension must be installed and in Provisioning succeeded state.
    3. The user must be assigned Virtual Machine User Login or Virtual Machine Administrator Login at the VM, resource group, or subscription scope.
    4. The user connects with az ssh vm or another supported Entra-based SSH method; if the user is not in one of those roles, the connection is closed with a permission error.

    Even when all of this is configured correctly, the shell inside the VM still runs under a local Linux account name, and whoami will show that local name, not the Entra ID or RBAC role.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.