Change Display Name in Azure for Azure AD joined Computers
If you rename your computer locally by using the Rename-Computer cmdlet or the Windows – System – settings page, after it was already joined to Microsoft Entra ID (formerly Azure Active Directory or Azure AD), unfortunately the display name will not get renamed/updated and reflected automatically in the Azure portal under the Microsoft Entra ID – All devices blade.
In order to update the display name in Microsoft Entra ID, either we can trigger a scheduled task on the local machine or we can use PowerShell. Both methods I will show in this post but to say it right away, to trigger a scheduled task is the best option. Further I will show how business customers this will handle usually by using a mobile device management (MDM) solution like Microsoft Intune.
There is also a workaround to get the display name reflected in Azure which I wouldn’t recommend to use. You can disconnect your Access work or school account from your computer and re-connect it. But in this case you need to provide a local account on the computer which you can use to sign-in after your organization account was disconnected, further you need to run through the wizard for Windows Hello for Business again after re-connecting the organization account. In general this workaround is really inconvenient.
Trigger a Scheduled Task
To show this option I will use the following virtual machine which was already Azure AD joined during the Windows Out of Box Experience (OOBE) and still using the initial auto-generated hostname.
Here you can see the virtual machine in the Azure portal.
Open the Task Scheduler and navigate to \Microsoft\Windows\Workplace Join\ . Here you will find the Device-Sync task which is using a custom trigger. Unfortunately I haven’t figured out yet what event will trigger that task, renaming, updating and rebooting our machine for sure will not trigger it as we can see below.
So far the task was never triggered and run.
Btw. the Automatic-Device-Join task shown below will be enabled when joining the computer to an on-premise domain and is used for Hybrid Azure AD join. More about you can read in my post Configure Hybrid Azure AD join for managed domains
Next I will rename and reboot my virtual machine to see if this will trigger the Device-Sync task
After rebooting the machine, the hostname was changed successful on the local machine.
Unfortunately the task wasn’t triggered by this event automatically what I actually would expect.
The last run result is still – The task has not yet run.
So I will try to run it by hand.
You can also run this task by using PowerShell and the cmdlet Start-ScheduledTask
Start-ScheduledTask -TaskName "Device-Sync" -TaskPath "\Microsoft\Windows\Workplace Join"
Task is running.
Task finished successfully. Now I am curious if the new hostname was synced as display name to Azure.
Here you are, the display name in the Azure portal was updated and therefore synced successfully from the virtual machine to Azure.
You will also find a corresponding log for the Device-Sync task in the Event Viewer under \Applications and Services Logs\Microsoft\Windows\User Device Registration\Admin
Further you will find here also logs about the original join request which happens when we signed-in to the computer the first time by using our organization account during the Windows Out of Box Experience (OOBE) or later by connecting the organization account under Settings – Accounts – Access work or school – Connect.
Now let’s check if also the OS version will be synced to Azure, so far I have Windows 11 version 22621.2283 installed on the virtual machine.
Fortunately there is a cumulative update available which I will install and what will raise our build number.
So far in the Azure portal the OS version is correct listed with the version before the cumulative update 10.0.0.22626.2283.
After installing the cumulative update and rebooting the virtual machine, the OS version now is raised to 22621.2361
Unfortunately our Device-Sync task wasn’t triggered this time either to run after the update and reboot from the virtual machine, the last run time is still from triggering the task by hand previously in order to update the displayName attribute.
Therefore also the OS version in the Azure portal was not synced and updated and is still listed with 10.0.0.22626.2283.
Now I will trigger the task again by hand to check if the OS version now will be synced to Azure.
In the Event Viewer under \Applications and Services Logs\Microsoft\Windows\User Device Registration\Admin I can see already that the deviceOSVersion attribute was successfully synced.
Also in the Azure portal the OS version was successfully updated.
So as mentioned to the beginning, unfortunately I haven’t figured out yet what event will trigger that task, as we saw, renaming, updating and rebooting the machine for sure will unfortunately not trigger it and we need to trigger the task by hand.
Change Display Name in Azure by using PowerShell
Another option to change the display name in Azure is to use PowerShell. Here for example I want to change the display name from my Azure AD joined computer nb-matrix1.
I will first have to connect to my Azure tenant by using the following PowerShell cmdlet.
PS > Connect-AzureAD
# In order to use the cmdlets you have to install the Microsoft Azure Active Directory Module for Windows PowerShell by executing the following command.
PS > Install-Module AzureAD
!! Note !!
PowerShell version 7 and later don’t support the Microsoft Azure Active Directory Module for Windows PowerShell and cmdlets with Msol in their name. For PowerShell version 7 and later, you must use the Microsoft Graph PowerShell SDK.
About how to use the Microsoft Graph PowerShell SDK to rename the display name, you will find in my following post https://blog.matrixpost.net/microsoft-graph-powershell/#updateDisplayName
To get a list of all devices in Microsoft Entra ID run
PS > Get-AzureADDevice
Then note the ObjectID from the device you want to change the display name and run the Set-AzureADDevice cmdlet as shown below to change it.
PS > Set-AzureADDevice -ObjectId <ObjectID Device> -DisplayName <new DisplayName>
A few seconds later the new display name should be updated and reflected in the Azure portal.
The Name field in the Azure portal is finally the DisplayName property for the device.
Rename Device Name in Microsoft Intune
Here in the Azure portal in Microsoft Entra ID (formerly Azure Active Directory or Azure AD), I have a virtual machine which is Azure AD joined and still have the default and origin hostname Desktop-CJ4J5I0.
If the computer is enrolled into Microsoft Intune, we can change the hostname here.
About how to enroll into Microsoft Intune you can read my following post.
In Microsoft Intune under Devices – All devices search and click for the computer you want to change the name for.
In the device blade click on Properties and Rename to change the computer name (device name).
Enter the new name and I will also enable a restart after the rename.
Rename and a restart was initiated and triggered.
So far nothing changed on the device.
A few seconds later after triggering the rename and restart, the device and signed-in user will get notified about the reboot.
A few minutes later the shutdown is scheduled in 2 minutes.
Finally the computer reboots.
After a reboot the hostname was renamed and updated.
The name was also updated and reflected in Microsoft Entra ID and Microsoft Intune.
Here in Microsoft Entra ID.
And here in Microsoft Intune.
Under device actions status you can see the last changes made to the device.
Using dsregcmd.exe to check the state locally on your Azure AD joined Computer
You can also check the state from your Azure AD joined computer by using the dsregcmd.exe /status command.
Here you can see all properties from your Azure AD joined computer in the Azure portal.
Checking the state directly on the computer by using dsregcmd.exe /status
You maybe also interested about how to change owner for Azure AD joined Windows Devices.
The Set-AzureADDevice cmdlet updates a device in Azure Active Directory (AD).
Connect to Microsoft 365 with PowerShell