This guide is intended primarily for system administrators and IT specialists who use Azure Active Directory (Azure AD) and join client devices to it.
Scenario
If you joined a device to Azure AD and then renamed it, the name change is not updated automatically in Azure AD or Intune.
Solution
The device name has to be changed manually using PowerShell.
Connecting to Azure AD:
- Run Windows PowerShell as an administrator.
- To connect to Azure AD through PowerShell, you need to have the “AzureAD” module installed. If you already have the module installed, continue with step 3.
Install-Module -Name AzureAD
- Sign in with an account that has global administrator rights.
$credential = Get-credential
Connect-AzureAD -Credential $credential
Changing the device name:
- Once you are connected, you need to find the “ObjectID” attribute, which identifies the specific device whose name you want to update. The following command displays a list of all devices joined to Azure AD along with their “ObjectID”.
Get-AzureADDevice
Find your device in the list and copy its “ObjectID”.
- Use the copied “ObjectID” to change the device name.
Set-AzureADDevice -objectID “objectID zařízení” -displayname “Nový název zařízení”
- You can verify that the name was changed in the web portal, in the list of devices (Devices), in Intune, or in PowerShell with this command:
Get-AzureADDevice -objectID “objectID zařízení”
Done!