How to Change Azure Device Owner with Microsoft Graph Powershell?

Jay Carper 216 Reputation points

The AzureAD module is being retired and I know how to do this using Add-AzureADDeviceRegisteredOwner. Please read the question before replying.

I have read the documentation for New-MgDeviceRegisteredOwnerByRef, but it appears to be incomplete. I don't see anything in the instructions about how to actually add a registered owner for a device. Is this the correct cmdlet? If so, how do you use it? If not, what is the correct cmdlet?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
9,950 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
18,641 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Vasil Michev 90,881 Reputation points MVP

    Yes, that's the "replacement" cmdlet. And yes, the documentation leaves a lot to be desired, but that's something you have to learn to live with, then it comes to the Graph SDK :(

    Here's an example on how to use it:

    New-MgDeviceRegisteredOwnerByRef -DeviceId dd16bf84-xxxx-xxxx-xxxx-89d42328529e -OdataId ""

    where you have to specify the device ID and the desired user's ID. The "" prefix is mandatory, as those cmdlets are all autogenerated and any concept of convenience is foreign to them.

    An alternative use of the cmdlet is:

    New-MgDeviceRegisteredOwnerByRef -DeviceId dd16bf84-xxxx-xxxx-xxxx-89d42328529e -BodyParameter @{"" = ""}