Change a device name in Azure AD using Microsoft Graph

Early this month, we explored how to discover device information using the Graph Explorer. Well one way we can edit that info (which is reported back into Azure AD) is with PowerShell. Let’s take a look.

If you’ve ever enrolled an Android device into Intune, you’ll notice that the device name is based on the date:

Android for Work device name

Now, that’s great for discovery, but it’s not exactly nice to look it. You would think you can go to the properties in Intune to update the Device name, but you can’t edit this field. For iOS and Windows devices, you can go into the Overview and push a Rename Device command though.

Device Name

In the Graph Explorer, we can query the device registered under my account and see ObjectID and Display Name. (Again – take a look at our post: Use Graph Explorer to discover property values for Dynamic Groups in Azure AD to learn more).

Graph API devices query

Now, if we want to edit that information, we want to use the Set-AzureADDevice PowerShell commandlet. This commandlet requires the AzureAD module – learn how to install it here: https://docs.microsoft.com/en-us/powershell/azure/active-directory/install-adv2?view=azureadps-2.0

All we need to do is connect to AzureAD in PowerShell and run the command! When you run Connect-AzureAD you’ll be prompted to sign in to your tenant:

Connect-AzureAD

Then, run the following command:

 Set-AzureADDevice -ObjectId "{id from Graph Explorer}" -DisplayName "{displayName from Graph Explorer}"
Set-AzureADDevice Command

No need to wait – go to Azure AD and hit refresh, and the new name will be there instantly.

Unfortunately, changing the device name in Azure AD won’t reflect back to Intune. I’ve explored most of the deviceManagement options in Graph Explorer and this just isn’t possible at the moment. If you’ve found a way to change it – let us know!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *